PyQt frameless window to inherit a variety of frameless widget
Project description
pyqt-frameless-window
PyQt frameless window
Requirements
- PyQt5 >= 5.15 - to call startSystemMove, startSystemResize which are introduced in Qt 5.15.
Setup
python -m pip install pyqt-frameless-window
Detailed Description
This is the empty window which has no frame. It looks nothing special, but it has a great feature.
It can be movable and resizable. That's not the only feature.
When you place the mouse cursor over the edge of the window, mouse cursor's shape will turn into one of those below based on direction of edge.
CursorShape in Qt Documentations
-
Qt.SizeVerCursor
-
Qt.SizeHorCursor
-
Qt.SizeBDiagCursor
-
Qt.SizeFDiagCursor
The window's minimum size is set to inner widget's recommended minimum size.
You can use this as a parent class if you want to make movable, resizable frameless window. This is no use on its own.
If you want to customize the title bar easily than use pyqt-custom-titlebar-setter, which also uses the pyqt-frameless-window.
If you don't need any title bar or min/max/close buttons or something like that, just use this as a parent class of your widget.
It can expand vertically when double-clicking the top or bottom edges of the window. Minor bug still remains, but it is not fatal at all.
Method Overview
-
setResizable(f: bool)
- Set resizable/none-resizable -
isResizable() -> bool
- Check if window is resizable or not -
setPressToMove(f: bool)
- Set movable/non-movable -
isPressToMove() -> bool
- Check if window is movable or not -
setMargin(margin: int)
- Set the margin which allows cursor to change its shape to resize form -
setFrameColor(color)
- Set the background color.color
argument type can be bothQColor
andstr
. -
getFrameColor -> QColor
- Get the background color. -
setVerticalExpandedEnabled(f: bool)
- Make it able to expand vertically when double-clicking the top or bottom edges of the window.
Example
Code Sample
from PyQt5.QtWidgets import QApplication
from pyqt_frameless_window import FramelessWindow
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
ex = FramelessWindow()
ex.show()
sys.exit(app.exec_())
Result
Try to move and resize it.
See Also
- pyqt-shadow-frame-window-example - Frameless window feature + rounded corner and shadow effect.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyqt-frameless-window-0.0.61.tar.gz
.
File metadata
- Download URL: pyqt-frameless-window-0.0.61.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ad7edd123c32866f02a85f7c3eda6569ae3afb4ab6dacdf351594a31bda1f86 |
|
MD5 | 48936c3f88005c1fbc40cff71d56b55d |
|
BLAKE2b-256 | 539b3bb450aa04fe4a831f162fe0bd1a63be9384bdf21e57884299ac273bbb68 |
File details
Details for the file pyqt_frameless_window-0.0.61-py3-none-any.whl
.
File metadata
- Download URL: pyqt_frameless_window-0.0.61-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 898f264b4d4007ec2cba0b27544c17a4bce4b2f36f62971e5ae1523d95c05010 |
|
MD5 | 538265b2d53a735c1d97d9ce915efbca |
|
BLAKE2b-256 | a37b49da2f4364a902050e6bc8fbdf657eb3bec8613a7ed2b8b063f046cad7e4 |