PyQt Custom Windows
Channel: MadPonyInteractive
Date: 10/12/2021

In this video we will learn how to create custom windows that can have any shape we like.
We will also re-implement most of the window functionality like dragging, resizing, full screen, multiple monitor support etc.

We will also check out how we can use web links, get screen and window size, mouse position and a few more handy methods.

If you are just looking for the code you can skip to the last chapter:
22:09  'Recap and grab the code'

NOTES:

I forgot to add an important flag that is responsible for minimization when you press the app icon in the taskbar and that is the Qt.WindowMinimizeButtonHint
So the full flags would be:
self.setWindowFlags(Qt.FramelessWindowHint|Qt.WindowMaximizeButtonHint|Qt.WindowMinimizeButtonHint)

^ is a python operator called XOR

If you don't want the window to be constrained to the screen you can replace:
x = max(pos.x(), 0)
y = max(pos.y(), 0)
screen = QGuiApplication.screenAt(QPoint(x, y)).size()
x = min(x, screen.width() - gr.width())
y = min(y, screen.height() - gr.height())
self.move(x, y)

with:
self.move(pos.x(), pos.y())


Timestamps:
00:00 Intro
01:57 Channel news
03:13 Removing the frame
04:26 Transparency
07:15 Functionality setup
08:17 Checking what's under mouse
08:43 Adding a web link
10:14 Full screen toggle
11:08 Event propagation
12:10 Getting event methods
13:24 Maximizing to single screen
15:30 Getting previous mouse position
17:04 Dragging the window
20:44 Getting the screen size
22:09 Recap and grab the code

Relevant Links
Window types documentation: https://doc.qt.io/qtforpython/PySide6/QtCore/Qt.html#PySide6.QtCore.PySide6.QtCore.Qt.WindowType
Qt Style Sheets: https://doc.qt.io/qtforpython/overviews/stylesheet-examples.html
PyQt & PySide Course Playlist: https://youtube.com/playlist?list=PLuvCsqbtUSFAEmez6Tuyi2KitVcS4fLWX



Support me on: 
https://www.buymeacoffee.com/MadPonyInt
https://gumroad.com/mad_pony_interactive
https://www.patreon.com/madponyinteractive
https://madponyinteractive.artstation.com/
https://flippednormals.com/creator/madponyinteractive/