Package: pyqt-custom-titlebar-setter
pyqt-custom-titlebar-setterPyQt custom titlebar setter.This is movable/resizable.When resizing, cursor shape will be automatically changed depends on the direction of edge where the cursor is hovering over.For example, you want to resize the window horizontally, cursor shape will be changed like "⇿".You can set the title, and icon which should be SVG type.You can set the min/max/close buttons separately.This package supports full-screen. If your app has full screen, this custom titlebar can perfectly deal with it. So there's no need to do another chore for full-screen.RequirementsPyQt5 >= 5.15 - This package is usingstartSystemMove,startSystemResizewhich were both introduced in Qt 5.15.Setuppython -m pip install pyqt-custom-titlebar-setterIncluded Packagespyqt-custom-titlebar-windowUsage`CustomTitlebarSetter.getCustomTitleBarWindow(main_window: QWidget, title: str = '', icon_filename: str = '',font: QFont = QFont('Arial', 14), hint: list = ['min', 'max', 'close'],

                          align=Qt.AlignCenter, bottom_separator: bool = False) -> CustomTitlebarWindow`main_windowis your widget.titleis windows title. If you set this by default (empty string), title is based of the title you set withsetWindowTitle.icon_filenameis title bar's icon. Icon file should be svg file. If it is not set, then there is no icon.fontis font of the title.hintis hint of the button on the title bar. For example, if you give the value such as ['min', 'close'], the title bar buttons will contain minimize and close buttons only.alignis alignment of the title. You can give Qt.AlignLeft, Qt.AlignCenter, Qt.AlignRight. Some of these are not recommended depending on the title bar button's position.bottom_separatordecides whether you want to put the separator(horizontal line) at the bottom of the title bar. If it is set to True, line will be shown between title bar and main widget.Example1. Very basic text editorCode SamplefromPyQt5.QtWidgetsimportQApplication,QWidget,QGridLayout,QTextEditfrompyqt_custom_titlebar_setterimportCustomTitlebarSetterclassTextEditor(QWidget):def__init__(self):super().__init__()self.__initUi()def__initUi(self):self.setWindowTitle('Text Editor')lay=QGridLayout()lay.addWidget(QTextEdit())self.setLayout(lay)if__name__=="__main__":importsysapp=QApplication(sys.argv)widget=TextEditor()window=CustomTitlebarSetter.getCustomTitleBarWindow(main_window=widget,icon_filename='dark-notepad.svg')window.show()sys.exit(app.exec_())ResultHow about dark theme?If you want to set dark theme, install thepyqt-style-setter, then write code like this....widget=TextEditor()StyleSetter.setWindowStyle(widget,theme='dark')# write it at this spot, BEFORE calling getCustomTitleBarWindow.window=CustomTitlebarSetter.getCustomTitleBarWindow(main_window=widget,icon_filename='dark-notepad.svg')...By the way, you can clearly see the title label and min/max/close button color changed based on background's colorautomatically.Now let's apply this to some of the applications.※ From now on, examples below are using dark theme. Of course, you don't have to use this.2.pyqt-dark-notepad-DarkNotepadAppclassCode SamplefromPyQt5.QtWidgetsimportQApplicationfrompyqt_dark_gray_theme.darkGrayThemeimport*frompyqt_dark_notepadimportDarkNotepadfrompyqt_style_setterimportStyleSetterfrompyqt_custom_titlebar_setterimportCustomTitlebarSetterclassDarkNotepadApp(QApplication):def__init__(self,*args,**kwargs):super().__init__(*args,**kwargs)mainWindow=DarkNotepad()StyleSetter.setWindowStyle(mainWindow,theme='dark')# you don't need this. this is just for adding style.self.__titleBarWindow=CustomTitlebarSetter.getCustomTitleBarWindow(mainWindow,icon_filename='ico/dark-notepad.svg')self.__titleBarWindow.show()Result3.pyqt-dark-calculator-CalculatorAppclassCode SamplefromPyQt5.QtWidgetsimportQApplication,QAbstractButtonfrompyqt_dark_gray_theme.darkGrayThemeimport*frompyqt_dark_calculator.calculatorimportCalculatorfrompyqt_style_setterimportStyleSetterfrompyqt_custom_titlebar_setterimportCustomTitlebarSetterclassCalculatorApp(QApplication):def__init__(self,*args,**kwargs):super().__init__(*args,**kwargs)mainWindow=Calculator()StyleSetter.setWindowStyle(mainWindow,theme='dark',exclude_type_lst=[QAbstractButton])self.__titleBarWindow=CustomTitlebarSetter.getCustomTitleBarWindow(mainWindow,icon_filename='ico/calculator.svg')self.__titleBarWindow.show()Result4.pyqt-comic-viewer-ComicBookViewerAppclassCode SamplefromPyQt5.QtWidgetsimportQApplicationfrompyqt_dark_gray_theme.darkGrayThemeimport*frompyqt_comic_viewer.comicBookViewerimportComicBookViewerfrompyqt_style_setterimportStyleSetterfrompyqt_custom_titlebar_setterimportCustomTitlebarSetterclassComicBookViewerApp(QApplication):def__init__(self,*args,**kwargs):super().__init__(*args,**kwargs)mainWindow=ComicBookViewer()StyleSetter.setWindowStyle(mainWindow,theme='dark')self.__titleBarWindow=CustomTitlebarSetter.getCustomTitleBarWindow(mainWindow,icon_filename='ico/book.svg')self.__titleBarWindow.show()Result