No project description provided
Project description
pywidgets-ext
This is a custom widget module for PySide6 that makes it easy to manage and use during development.
Installation
Install using pip:
pip install pywidgets-ext
Install using poetry (recommended):
poetry add pywidgets-ext
Usage
from pywidgets_ext import *
Modules
PyFigureCanvas
PyFigureCanvas is a custom widget inheriting from FigureCanvasQTAgg. It's designed to display matplotlib charts. A unique feature is its magnified preview when the mouse hovers over it, which hides when the mouse leaves. The magnified view adjusts according to the screen size and mouse position. Additionally, PyFigureCanvas offers methods to get chart dimensions, calculate data ratio, and adjust graphics view size on resize.
To see it in action:
python -m pywidgets_ext.PyFigureCanvas
Sample code:
import matplotlib.pyplot as plt
from PySide6.QtWidgets import QMainWindow, QApplication
from pywidgets_ext import PyFigureCanvas
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
fig, ax = self.create_sample_plot()
self.canvas = PyFigureCanvas(fig)
self.setup_main_window()
def create_sample_plot(self):
fig, ax = plt.subplots(figsize=(5, 5))
ax.plot([0, 1, 2, 3, 4], [0, 1, 4, 9, 16], label="y = x^2")
ax.set_title("Sample Plot")
ax.set_xlabel("x")
ax.set_ylabel("y")
ax.legend()
return fig, ax
def setup_main_window(self):
self.setCentralWidget(self.canvas)
self.setWindowTitle("PyFigureCanvas Demo")
self.resize(600, 600)
if __name__ == "__main__":
app = QApplication([])
window = MainWindow()
window.show()
app.exec()
PyGraphicsView
PyGraphicsView is a view class inheriting from QGraphicsView. It lets users click and drag in the scene to draw and adjust resizable rectangular regions (ResizableRect). It offers specific drawing and optimization options for better performance and visuals. Users can select rectangles and delete them using the Delete key. Also, it auto-adjusts rectangles when the scene size changes.
To see it in action:
python -m pywidgets_ext.PyGraphicsView
Sample code:
from PySide6.QtCore import Qt, QRectF, QPointF
from PySide6.QtWidgets import QApplication, QMainWindow
from pywidgets_ext import PyGraphicsView
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.view = PyGraphicsView()
self.view.setSceneRect(0, 0, 500, 500)
self.setCentralWidget(self.view)
self.setGeometry(100, 100, 800, 600)
self.setWindowTitle("PyGraphicsView Example")
if __name__ == "__main__":
app = QApplication([])
window = MainWindow()
window.show()
app.exec()
Contributions
Contributions of any kind are welcome! Make sure to read the Contribution Guide first.
License
This project is under the MIT License.
Author
- Leo - Github
Project details
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 pywidgets_ext-0.1.5.tar.gz.
File metadata
- Download URL: pywidgets_ext-0.1.5.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.11 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0349cafe84fc2743def2e241cb01f3136b1e7b7807af04ad2d7c0c795a0cf490
|
|
| MD5 |
40242fbfdff5c27caa9338f0807fb69a
|
|
| BLAKE2b-256 |
b7a96ea1310ddbe4e9497b286ba7a53b2edc4d473a7b706d680a74227d6137cf
|
File details
Details for the file pywidgets_ext-0.1.5-py3-none-any.whl.
File metadata
- Download URL: pywidgets_ext-0.1.5-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.11 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b183ccb7c003ff5353df6bc69de66e5ccca6d10cb6114a36990dd798892f0e3
|
|
| MD5 |
73abcc19158e4a2c2d29f6c47fcb97c0
|
|
| BLAKE2b-256 |
bcdddcfbf64df7070dfec4de9ccdc1982b49c544dffcbf3fe299e6e5fdde7b4c
|