PySide6 drawer
Project description
PySide6-Drawer
PySide6 drawer - based on pyqt-drawer
You can set the widget to drawer.
Opening, closing drawer involved animations of size change and drawer/parent window's opacity.
Requirements
see requirements.txt
Setup
python -m pip install PySide6-Drawer
Feature
-
Drawer(parent, widget: QWidget, alignment)Constructor.parentis parent windowwidgetis the widget you want to set in the drawer.alignmentPlacement of drawer. Currently support Qt.AlignTop, Qt.AlignLeft, Qt.AlignRight, Qt.AlignBottom
-
Being able to set size/opacity duration with
drawer.setDuration(msc) -
Being able to set end size value with
drawer.setEndValue(size) -
Call .toggleDrawer to toggle the drawer's visibility. In the example below, the QPushButton clicked signal will call this; up to the user to handle the button state
Example
Code Example
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QMainWindow, QApplication, QWidget, QGridLayout, QPushButton, QSizePolicy
from pyside6_drawer.drawer import Drawer
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.__initUi()
def __initUi(self):
mainWidget = QWidget()
mainWidget.setLayout(QGridLayout())
# Content behind widget
pb = QPushButton("Content", mainWidget)
pb.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
mainWidget.layout().addWidget(pb)
pb.clicked.connect(lambda: print("Content Clicked!"))
# Left side drawer and button
leftWidget = QPushButton("Left Drawer")
leftWidget.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
drawerLeft = Drawer(self, leftWidget, alignment=Qt.AlignmentFlag.AlignLeft)
mainWidget.layout().addWidget(drawerLeft, 0, 0, 1, 1)
pb = QPushButton("Open Drawer", mainWidget)
mainWidget.layout().addWidget(pb, 0, 0, 0, 0, Qt.AlignLeft)
pb.clicked.connect(drawerLeft.toggleDrawer)
# Top side drawer and button
topWidget = QPushButton("Top Drawer")
topWidget.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
drawerTop = Drawer(mainWidget, topWidget, alignment=Qt.AlignmentFlag.AlignTop)
mainWidget.layout().addWidget(drawerTop, 0, 0, 1, 1)
pb = QPushButton("Open Drawer", mainWidget)
mainWidget.layout().addWidget(pb, 0, 0, 0, 0, Qt.AlignTop|Qt.AlignCenter)
pb.clicked.connect(drawerTop.toggleDrawer)
# Right side drawer and button
rightWidget = QPushButton("Right Drawer")
rightWidget.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
drawerRight = Drawer(self, rightWidget, alignment=Qt.AlignmentFlag.AlignRight)
mainWidget.layout().addWidget(drawerRight, 0, 0, 1, 1)
pb = QPushButton("Open Drawer", mainWidget)
mainWidget.layout().addWidget(pb, 0, 0, 0, 0, Qt.AlignRight)
pb.clicked.connect(drawerRight.toggleDrawer)
# Bottom side drawer and button
bottomWidget = QPushButton("Bottom Drawer")
bottomWidget.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
drawerBottom = Drawer(mainWidget, bottomWidget, alignment=Qt.AlignmentFlag.AlignBottom)
mainWidget.layout().addWidget(drawerBottom, 0, 0, 1, 1)
pb = QPushButton("Open Drawer", mainWidget)
mainWidget.layout().addWidget(pb, 0, 0, 0, 0, Qt.AlignBottom|Qt.AlignCenter)
pb.clicked.connect(drawerBottom.toggleDrawer)
mainWidget.layout().setContentsMargins(0, 0, 0, 0)
self.setCentralWidget(mainWidget)
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
mainWindow = MainWindow()
mainWindow.setWindowTitle("PySide6 Drawer")
mainWindow.show()
mainWindow.setMinimumSize(600, 600)
app.exec()
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyside6-drawer-0.0.1.tar.gz.
File metadata
- Download URL: pyside6-drawer-0.0.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9909afcefa1d7537a8f3b0d5342e3f6ca25db0aecacca5a17296a09c2778fc1e
|
|
| MD5 |
665b6b6c395eb1af30090345be15095d
|
|
| BLAKE2b-256 |
06d44cb80b207147ba6fd585e963df9286724922adfe2ef064546cafef0ae3c2
|
File details
Details for the file pyside6_drawer-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pyside6_drawer-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83930317b57d3ee28208f33ef49323cb1b3bdf3d95e2aa905183117d9075b409
|
|
| MD5 |
645f99de29499152ceba75119a2b801a
|
|
| BLAKE2b-256 |
d65646df9b7d65f0675c72d805b16a7f231c12fd2ddac39bb2c5b561c3618beb
|