setWindowStyle ( mainWindow, theme = 'dark' ) # you don't need this. _init_ ( * args, ** kwargs ) mainWindow = DarkNotepad () StyleSetter. pyqt-dark-notepad - DarkNotepadApp classĬode Sample from PyQt5.QtWidgets import QApplication from pyqt_dark_gray_theme.darkGrayTheme import * from pyqt_dark_notepad import DarkNotepad from pyqt_style_setter import StyleSetter from pyqt_custom_titlebar_setter import CustomTitlebarSetter class DarkNotepadApp ( QApplication ): def _init_ ( self, * args, ** kwargs ): super (). ※ From now on, examples below are using dark theme. Now let's apply this to some of the applications. īy the way, you can clearly see the title label and min/max/close button color changed based on background's color automatically. getCustomTitleBarWindow ( main_window = widget, icon_filename = 'dark-notepad.svg' ). setWindowStyle ( widget, theme = 'dark' ) # write it at this spot, BEFORE calling getCustomTitleBarWindow. If you want to set dark theme, install the pyqt-style-setter, then write code like this. getCustomTitleBarWindow ( main_window = widget, icon_filename = 'dark-notepad.svg' ) window. argv ) widget = TextEditor () window = CustomTitlebarSetter. setLayout ( lay ) if _name_ = "_main_" : import sys app = QApplication ( sys. setWindowTitle ( 'Text Editor' ) lay = QGridLayout () lay. If it is set to True, line will be shown between title bar and main widget.Ĭode Sample from PyQt5.QtWidgets import QApplication, QWidget, QGridLayout, QTextEdit from pyqt_custom_titlebar_setter import CustomTitlebarSetter class TextEditor ( QWidget ): def _init_ ( self ): super (). Some of these are not recommended depending on the title bar button's position.īottom_separator decides whether you want to put the separator(horizontal line) at the bottom of the title bar. You can give Qt.AlignLeft, Qt.AlignCenter, Qt.AlignRight. For example, if you give the value such as, the title bar buttons will contain minimize and close buttons only.Īlign is alignment of the title. Hint is hint of the button on the title bar. If you set this by default (empty string), title is based of the title you set with setWindowTitle. `CustomTitlebarSetter.getCustomTitleBarWindow(main_window: QWidget, title: str = '', icon_filename: str = '', font: QFont = QFont('Arial', 14), hint: list = ,Īlign=Qt.AlignCenter, bottom_separator: bool = False) -> CustomTitlebarWindow` Python -m pip install pyqt-custom-titlebar-setter Included Packages
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |