kigo-gui-framework 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
kigo/_init_.py
ADDED
kigo/app.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from PyQt6.QtWidgets import QApplication, QWidget, QVBoxLayout
|
|
2
|
+
from PyQt6.QtCore import QSize
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
class App:
|
|
6
|
+
def __init__(self, title="Kigo App", size=(500, 400)):
|
|
7
|
+
# QApplication must be created first (or passed in)
|
|
8
|
+
self.app = QApplication.instance()
|
|
9
|
+
if self.app is None:
|
|
10
|
+
self.app = QApplication(sys.argv)
|
|
11
|
+
|
|
12
|
+
# The main window is a QWidget
|
|
13
|
+
self.root = QWidget()
|
|
14
|
+
self.root.setWindowTitle(title)
|
|
15
|
+
self.root.resize(QSize(size[0], size[1]))
|
|
16
|
+
|
|
17
|
+
# Create a layout manager for the main window
|
|
18
|
+
self.layout = QVBoxLayout()
|
|
19
|
+
self.root.setLayout(self.layout)
|
|
20
|
+
|
|
21
|
+
def add(self, widget):
|
|
22
|
+
# We assume the widget's render method returns the PyQt widget
|
|
23
|
+
# The widget must be added to the layout manager, not the root directly
|
|
24
|
+
pyqt_widget = widget.render(self.root)
|
|
25
|
+
self.layout.addWidget(pyqt_widget)
|
|
26
|
+
|
|
27
|
+
def run(self):
|
|
28
|
+
self.root.show()
|
|
29
|
+
# Start the event loop
|
|
30
|
+
sys.exit(self.app.exec())
|
kigo/widgets.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
from PyQt6.QtWidgets import QLabel, QPushButton, QLineEdit, QComboBox, QWidget, QVBoxLayout
|
|
2
|
+
from PyQt6.QtCore import Qt, pyqtSignal
|
|
3
|
+
|
|
4
|
+
# The base class for all widgets
|
|
5
|
+
class WidgetBase:
|
|
6
|
+
def render(self, parent: QWidget):
|
|
7
|
+
"""Creates and returns the native PyQt6 widget."""
|
|
8
|
+
raise NotImplementedError("Subclasses must implement the render method.")
|
|
9
|
+
|
|
10
|
+
class Label(WidgetBase):
|
|
11
|
+
def __init__(self, text):
|
|
12
|
+
self.text = text
|
|
13
|
+
|
|
14
|
+
def render(self, parent):
|
|
15
|
+
# QLabel is the PyQt equivalent of tk.Label
|
|
16
|
+
lbl = QLabel(self.text, parent)
|
|
17
|
+
# We don't need .pack() anymore; positioning is handled by the layout manager
|
|
18
|
+
return lbl
|
|
19
|
+
|
|
20
|
+
class Button(WidgetBase):
|
|
21
|
+
def __init__(self, text, on_click=None):
|
|
22
|
+
self.text = text
|
|
23
|
+
self.on_click = on_click
|
|
24
|
+
|
|
25
|
+
def render(self, parent):
|
|
26
|
+
# QPushButton is the PyQt equivalent of tk.Button
|
|
27
|
+
btn = QPushButton(self.text, parent)
|
|
28
|
+
|
|
29
|
+
if self.on_click:
|
|
30
|
+
# Connect the button's clicked signal to the user's on_click function
|
|
31
|
+
btn.clicked.connect(self.on_click)
|
|
32
|
+
|
|
33
|
+
return btn
|
|
34
|
+
|
|
35
|
+
class TextBox(WidgetBase):
|
|
36
|
+
def __init__(self, width=20):
|
|
37
|
+
# Width is handled by the layout, but kept for interface consistency
|
|
38
|
+
self.width = width
|
|
39
|
+
self._pyqt_entry = None # Store the QLineEdit instance
|
|
40
|
+
|
|
41
|
+
def render(self, parent):
|
|
42
|
+
# QLineEdit is the PyQt equivalent of tk.Entry
|
|
43
|
+
self._pyqt_entry = QLineEdit(parent)
|
|
44
|
+
# Note: Setting width directly is discouraged in PyQt, relying on layouts
|
|
45
|
+
return self._pyqt_entry
|
|
46
|
+
|
|
47
|
+
def get_text(self):
|
|
48
|
+
if self._pyqt_entry is not None:
|
|
49
|
+
return self._pyqt_entry.text()
|
|
50
|
+
return ""
|
|
51
|
+
|
|
52
|
+
class Dropdown(WidgetBase):
|
|
53
|
+
def __init__(self, options):
|
|
54
|
+
self.options = options
|
|
55
|
+
self._pyqt_combo = None # Store the QComboBox instance
|
|
56
|
+
|
|
57
|
+
def render(self, parent):
|
|
58
|
+
# QComboBox is the PyQt equivalent of tk.OptionMenu
|
|
59
|
+
self._pyqt_combo = QComboBox(parent)
|
|
60
|
+
self._pyqt_combo.addItems(self.options)
|
|
61
|
+
|
|
62
|
+
return self._pyqt_combo
|
|
63
|
+
|
|
64
|
+
def get_selected(self):
|
|
65
|
+
if self._pyqt_combo is not None:
|
|
66
|
+
return self._pyqt_combo.currentText()
|
|
67
|
+
return None
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kigo-gui-framework
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A simple GUI library built on PyQt6
|
|
5
|
+
Author-email: Anand Kumar <swiss.armyknife@github.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
Project-URL: Homepage, https://github.com/yourusername/kigo-gui-framework
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Requires-Python: >=3.8
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
Requires-Dist: PyQt6==6.7.0
|
|
15
|
+
|
|
16
|
+
This is the README of the kigo-gui-framework v0.2.0.
|
|
17
|
+
It follows the MIT Licence.
|
|
18
|
+
Do you like PyQt6, but you dont wanna write all the code? Well, kigo-gui-framework is your bet! Its open source, and you can code in the extremely simple syntax to get a pyqt6 window! Check out the GitHub repo at https:\\github.com\TheYoungDev430\kigo-gui-framework2.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
kigo/_init_.py,sha256=UzPub4g4MD43O_pbC6RA88I24oMTJLu8oMlJyX9rtyc,128
|
|
2
|
+
kigo/app.py,sha256=eV_Wm4F7IqiFBTh7z7a_BTZfQNnvu3FX-y-x-7MA0R8,1074
|
|
3
|
+
kigo/widgets.py,sha256=BTAGqZcafLA1h6wNZz42FvPQsbvDPUDRoJDFyJEHjrc,2321
|
|
4
|
+
kigo_gui_framework-0.2.0.dist-info/METADATA,sha256=ZXmjexdytBDLM374y5rqRfGeFi3GQXKn8uHP6qRvZlo,908
|
|
5
|
+
kigo_gui_framework-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
6
|
+
kigo_gui_framework-0.2.0.dist-info/top_level.txt,sha256=nLudA0QBdfLRaDN8bfj-8KmNRlrfpQnIRIP-s9SG_w4,5
|
|
7
|
+
kigo_gui_framework-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
kigo
|