0

Recently, I designed a Python application (PySide2 and QT-PyQt-PySide-Custom-Widgets) without a title bar. I achieved this by modifying the "QMainWindow" property in the "style.json" file as specified in the documentation:

"QMainWindow":[
    {
        "tittle":"MyApp",
        "icon":":/icons/Icons/activity.png",
        "frameless": true,
        "transluscentBg": true,
        "sizeGrip": "size_grip",
        "shadow":[
            {
                "color": "#fff",
                "blurRadius": 20,
                "xOffset": 0,
                "yOffset": 0,
                "centralWidget": "centralwidget"
            }
        ],
        "navigation":[
            {
                "minimize":"minimizeButton",
                "close": "quitButton",
                "restore":[
                    {
                        "buttonName": "maximizeButton",
                        "normalIcon": ":/icons/Icons/square.png",
                        "maximizedIcon": ":/icons/Icons/copy.png"
                    }
                ],
                "moveWindow": "titleBar",
                "tittleBar": "titleBar"
            }
        ]
    }
]

That works fine and I can see the window without the system's title bar.

enter image description here

However, when generating an executable with PyInstaller, the system's title bar reappears.

Pyinstaller myapp.py --onefile --windowed

enter image description here

Furthermore, the buttons on my custom title bar stops working and no longer responds to dragging the window.

Dan A.S.
  • 654
  • 8
  • 24
  • That "module" is known to have a terribly written spaghetti code, is poorly maintained and also inconsistent and unreliable. I strongly advise you to *not* use it. – musicamante Apr 02 '23 at 15:34
  • I am familiar with PySide2 issues perfectly. I haven't asked about them. If you know any other technology that is better than PySide2 and allows me to design modern interfaces in Python with CSS, I would appreciate it if you shared it – Dan A.S. Apr 02 '23 at 15:43
  • 1
    I was not talking about PySide, but about that "QT-PyQt-PySide-Custom-Widgets". – musicamante Apr 02 '23 at 16:10
  • @musicamante Do you know of any similar, better alternatives to "Responsive Gui Widgets" in QT-PyQt-Pyside-Widgets? – Dan A.S. Apr 02 '23 at 20:17
  • First of all, both PySide and PyQt are Python bindings for the Qt framework, which already provides some form of "responsiveness". Note that you should consider that term not exactly like it is in the web browser context (where elements can even completely change their appearance, position, order etc): the behavior is just what is commonly expected from desktop programs, with *layout managers* that can change size and geometries of every element according to the size of the top level window. If that's what you mean, then Qt is perfectly fine for that. Appearance might not be as "modern" as -> – musicamante Apr 02 '23 at 20:49
  • -> you'd think, as the default look is that of a normal desktop program, and there's no default style that resembles UI designs we could see in some mobile/web apps (Material Design, etc). That is still achievable, though, either by properly using QSS (Qt Style Sheets) or some third party styles (eg [QDarkStyleSheet](//github.com/ColinDuquesnoy/QDarkStyleSheet)). – musicamante Apr 02 '23 at 20:56
  • I'm referring to animations (such as those in the sidebar) like these... https://www.youtube.com/watch?v=adC48qZ8p5Y. – Dan A.S. Apr 02 '23 at 21:11
  • That video is more than one hour long (and it has too many ads), so please clarify what you're referring to. Besides, that "Custom-Widgets" module *is based on Qt*, so there's nothing fancy about it, it just uses what Qt provides, meaning that you can do all that without that awfully written module. – musicamante Apr 02 '23 at 21:48
  • Sure, but what you see in the 1-hour video takes 3 months to do manually. Of course, everything can be done from scratch xD. – Dan A.S. Apr 03 '23 at 11:47
  • 1
    What about [PySide2-Fluent-Widgets](https://github.com/zhiyiYo/PyQt-Fluent-Widgets/tree/PySide2) or [PySide2-Frameless-Window](https://github.com/zhiyiYo/PyQt-Frameless-Window/tree/Pyside2)? Are there from the same codebase? – noEmbryo Apr 03 '23 at 12:04
  • @DanA.S. That wasn't the point: I won't watch a 1 hour long video in order to know what you want to do. Besides, implementing animations in Qt is not that difficult (the [animation framework](https://doc.qt.io/qt-5/animation-overview.html) provides animation classes that can easily apply changes to widget geometries). – musicamante Apr 03 '23 at 17:30

0 Answers0