{"id":18077363,"url":"https://github.com/parisneo/oopygame","last_synced_at":"2025-04-05T20:13:03.280Z","repository":{"id":57448922,"uuid":"450917716","full_name":"ParisNeo/oopygame","owner":"ParisNeo","description":"Object oriented wrapper on pygame to simplify making UI","archived":false,"fork":false,"pushed_at":"2022-01-30T21:03:02.000Z","size":30,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-12T03:38:45.143Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ParisNeo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-22T19:38:43.000Z","updated_at":"2022-01-29T00:17:26.000Z","dependencies_parsed_at":"2022-09-16T13:51:09.531Z","dependency_job_id":null,"html_url":"https://github.com/ParisNeo/oopygame","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParisNeo%2Foopygame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParisNeo%2Foopygame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParisNeo%2Foopygame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParisNeo%2Foopygame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ParisNeo","download_url":"https://codeload.github.com/ParisNeo/oopygame/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393572,"owners_count":20931813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-31T11:24:23.661Z","updated_at":"2025-04-05T20:13:03.210Z","avatar_url":"https://github.com/ParisNeo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OOPyGame\n\nObject oriented wrapper on pygame to simplify making UI for pygame applications.\nSupported layouts:\n- Absolute layout (default one)\n- Horizontal layout\n- Vertical layout\n\nSupported widgets:\n- Widget\n- Button\n- Label\n- ImageBox\n- Slider\n- List\n- MenuBar\n- Menu\n- Action\n\nTo use the library, import the windowmanager and the needed widgets from PyGameUI\n\n```python\nfrom OOPyGame import WindowManager, Button, List, MenuBar, Menu, Action, MenuSeparator, HorizontalLayout, VerticalLayout, ImageBox, Slider\nimport pygame\n# ===== Build pygame window and populate with widgets ===================\npygame.init()\nclass MainWindow(WindowManager):\n    def __init__(self):\n        # Initialize the window manager\n        WindowManager.__init__(self, \"Face box\", (800,600))\n        self.mn_bar = self.build_menu_bar()\n        self.file = Menu(self.mn_bar,\"File\")\n        new = Action(self.file,\"New\")\n        sep = MenuSeparator(self.file)\n        quit = Action(self.file,\"Quit\")\n        quit.clicked_event_handler = self.fn_quit\n        self.edit = Menu(self.mn_bar,\"Edit\")\n\n        self.layout_1 = HorizontalLayout()\n        self.layout_2 = VerticalLayout()\n\n        # Build an image Box\n        self.main_video = ImageBox()\n\n        # Build a slider\n        self.time_slider = Slider()\n        self.time_slider.value=0.5\n        self.time_slider.valueChanged_callback = self.slider_updated\n        self.time_slider.mouse_down_callback = self.slider_mouse_down\n\n        # Build a list of items\n        self.test_ui1 = List(list=[f\"item {i}\" for i in range(100)])\n        self.test_ui3 = Button(\"Hello 3\")\n\n        self.layout_1.addWidget(self.test_ui1,0.2)\n        self.layout_1.addWidget(self.layout_2,0.8)\n\n        self.layout_2.addWidget(self.main_video,0.7)\n        self.layout_2.addWidget(self.time_slider,0.05)\n\n        self.layout_2.addWidget(self.test_ui3,0.25)\n\n        self.addWidget(self.layout_1)\n\n        # Build a timer that repeats every 1/24 secondes\n        self.timer = self.build_timer(self.do_stuf,1/24)\n        self.timer.start()\n\n    def slider_mouse_down(self):\n        # when the slider is pressed with mouse this callback is triggered\n        pass\n\n    def slider_updated(self, val):\n        # When slider value changed this callback is triggered\n        pass\n\n    def do_stuf(self):\n        # Here do something that will be executed every timer tick\n        pass\n\n    def fn_quit(self):\n        self.Running=False\n\n# =======================================================================\n\n#\n#clip.preview()\nif __name__==\"__main__\":\n    mw = MainWindow()\n    mw.loop()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparisneo%2Foopygame","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparisneo%2Foopygame","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparisneo%2Foopygame/lists"}