OOPyGame
Object oriented wrapper on pygame to simplify making UI for pygame applications. Supported layouts:
- Absolute layout (default one)
- Horizontal layout
- Vertical layout
Supported widgets:
- Widget
- Button
- Label
- ImageBox
- Slider
- List
- MenuBar
- Menu
- Action
To use the library, import the windowmanager and the needed widgets from PyGameUI
from OOPyGame import WindowManager, Button, List, MenuBar, Menu, Action, MenuSeparator, HorizontalLayout, VerticalLayout, ImageBox, Slider
import pygame
# ===== Build pygame window and populate with widgets ===================
pygame.init()
class MainWindow(WindowManager):
def __init__(self):
# Initialize the window manager
WindowManager.__init__(self, "Face box", (800,600))
self.mn_bar = self.build_menu_bar()
self.file = Menu(self.mn_bar,"File")
new = Action(self.file,"New")
sep = MenuSeparator(self.file)
quit = Action(self.file,"Quit")
quit.clicked_event_handler = self.fn_quit
self.edit = Menu(self.mn_bar,"Edit")
self.layout_1 = HorizontalLayout()
self.layout_2 = VerticalLayout()
# Build an image Box
self.main_video = ImageBox()
# Build a slider
self.time_slider = Slider()
self.time_slider.value=0.5
self.time_slider.valueChanged_callback = self.slider_updated
self.time_slider.mouse_down_callback = self.slider_mouse_down
# Build a list of items
self.test_ui1 = List(list=[f"item {i}" for i in range(100)])
self.test_ui3 = Button("Hello 3")
self.layout_1.addWidget(self.test_ui1,0.2)
self.layout_1.addWidget(self.layout_2,0.8)
self.layout_2.addWidget(self.main_video,0.7)
self.layout_2.addWidget(self.time_slider,0.05)
self.layout_2.addWidget(self.test_ui3,0.25)
self.addWidget(self.layout_1)
# Build a timer that repeats every 1/24 secondes
self.timer = self.build_timer(self.do_stuf,1/24)
self.timer.start()
def slider_mouse_down(self):
# when the slider is pressed with mouse this callback is triggered
pass
def slider_updated(self, val):
# When slider value changed this callback is triggered
pass
def do_stuf(self):
# Here do something that will be executed every timer tick
pass
def fn_quit(self):
self.Running=False
# =======================================================================
#
#clip.preview()
if __name__=="__main__":
mw = MainWindow()
mw.loop()
Metadata
Release files for OOPyGame 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| OOPyGame-0.0.5.tar.gz | 21.8 kB | Without provenance | Details for OOPyGame-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| OOPyGame-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for OOPyGame-0.0.5-py3-none-any.whl |
Total release size: 62.5 kB
Release files / OOPyGame-0.0.5.tar.gz
| Download URL | OOPyGame-0.0.5.tar.gz |
|---|---|
| Size | 21.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e009052503bab6dcd22ab240d60f86f9718e6631848897007fe819394d41111
|
|
BLAKE2b-256 checksum How to use checksums |
40f18f98effc810a01e63b58dbc58d15fa393a59acfa452299c7f24154ee4a19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7
|
Release files / OOPyGame-0.0.5-py3-none-any.whl
| Download URL | OOPyGame-0.0.5-py3-none-any.whl |
|---|---|
| Size | 40.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3f7f1db1e6e44f37a8f2bf66411e6b921368db5ce0b9453ff52ea3c38e5dc404
|
|
BLAKE2b-256 checksum How to use checksums |
7b15f93bd0426285bed3ce23b9b250e0ea36347aef006ef238d651c7ea4852eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7
|
Security for OOPyGame 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.