Python Forum
Menus, buttons and other widgets for Pygame
Thread Rating:
  • 2 Vote(s) - 1.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Menus, buttons and other widgets for Pygame
#5
pyglet also doesnt have any UI like buttons as well (i think). Pyglet is like pygame. I feel like the community is smaller in pyglet than in pygame. 

Kivy is mainly for mobile devices and actually has its own language. Most of the time you are not typing out python syntax but kivy syntax. Here is a small example of an input box and label in kivy
<ScatterTextWidget>:
    orientation: 'vertical'
    TextInput:
        id: my_textinput
        font_size: 150
        size_hint_y: None
        height: 200
        text: 'default'
    FloatLayout:
        Scatter:
            Label:
                text: my_textinput.text
                font_size: 150
while here is the python script that runs it
from kivy.app import App

from kivy.uix.scatter import Scatter
from kivy.uix.label import Label
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.textinput import TextInput
from kivy.uix.boxlayout import BoxLayout

class ScatterTextWidget(BoxLayout):
    pass

class MainApp(App):
    def build(self):
        return ScatterTextWidget()

if __name__ == "__main__":
    MainApp().run()
As you can see the meat of the program is in the kivy syntax
Quote:So is the basic idea that I should mostly do it myself, using other's codes for examples?
Yeah its kinda stupid that they havent implemented a basic UI system. You do get use to it. Once you find good code, and understand it, you dont have to change it much....if ever. I have always used the same button class for years in all my games without changing the button code because its flexible to handle multiple situations. You just have to keep uploading it to each of your games instead of expecting it to be in pygame. 

check out @[Mekire] github
https://github.com/Mekire

It has a lot of basic examples for learning and as well as some repos of good coded flexible UI tools off the bat.
Recommended Tutorials:
Reply


Messages In This Thread
RE: Menus, buttons and other widgets for Pygame - by metulburr - Apr-17-2017, 11:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] pygame-manu : using controller buttons to move around menu mlw19mlw91 2 1,665 Mar-12-2023, 01:55 PM
Last Post: deanhystad
  Pygame - Images As Buttons vman44 3 13,059 Mar-20-2020, 08:13 PM
Last Post: vman44
  [pygame] Equiping inventory slots with invisible buttons SheeppOSU 6 4,764 Apr-26-2019, 08:45 PM
Last Post: SheeppOSU
  Problems with loading buttons (pygame) SheeppOSU 2 3,138 Apr-12-2019, 08:04 PM
Last Post: SheeppOSU
  Buttons in PyGame mzmingle 4 13,101 Oct-09-2018, 05:19 PM
Last Post: Mekire

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020