Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yjg30737/pyqt-foldable-window

PyQt foldable window
https://github.com/yjg30737/pyqt-foldable-window

pyqt pyqt-examples pyqt-gui pyqt-qmenubar pyqt-tutorial pyqt5 pyqt5-examples pyqt5-gui pyqt5-qmenubar pyqt5-tutorial python python3 python37 qmenubar qpushbutton qt qwidget

Last synced: about 1 month ago
JSON representation

PyQt foldable window

Awesome Lists containing this project

README

        

# pyqt-foldable-window
PyQt foldable window

I will add this feature to pyqt-custom-titlebar-window.

Even though this included aforementioned package.

## Requirements
PyQt5 >= 5.8

## Setup
`pip3 install git+https://github.com/yjg30737/pyqt-foldable-window.git --upgrade`

## Included Packages
* pyqt-svg-button
* pyqt-resource-helper
* pyqt-custom-titlebar-window

## Feature
* Being able to fold, unfold window by toggle button on the menu bar
* Being able to move the window with dragging menu bar

## Example
```python
from PyQt5.QtWidgets import QApplication, QMainWindow, QMenu
from pyqt_foldable_window import FoldableWindow

class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.__initUi()

def __initUi(self):
fileMenu = QMenu('File', self)
self.menuBar().addMenu(fileMenu)

if __name__ == "__main__":
import sys

app = QApplication(sys.argv)
window = FoldableWindow(MainWindow())
window.show()
app.exec_()
```

Result

Note: Preview below is very first version. Current version(0.3.0) icons are svg, so they are not blurry anymore.

Unfolded state

![image](https://user-images.githubusercontent.com/55078043/152663899-93b65dbd-5763-448a-a421-58681be3f3b7.png)

Folded state

![image](https://user-images.githubusercontent.com/55078043/152663909-8a7766b7-3efc-4398-bbc8-73094be9aa87.png)

## Note
`FoldableWindow`'s argument should be only `QMainWindow` kind of class that `QMenuBar` exists. If that is not exist, error will occur.

## See Also
* pyqt-foldable-item-list-widget