Пример #1
0
def poos():
    Scene.scene = "pause"

def bacc():
    Scene.scene = "menu"
# INITAILIZE GUI

# The begin Button
start = Button(text="Begin", rect = (0, 0, 300, 60),
               bg = (100, 100, 100), fg = (255, 255, 255),
               bgr = (0, 100, 200), tag = ("menu", None))
        
start.Left = 400 - start.Width / 2
start.Top = (300 - start.Height / 2) + 100
start.Command = startt

# The Quit Button
begone = Button(text = "Quit", rect = (0, 0, 300, 60),
                bg = (100, 100, 100), fg = (255, 255, 255),
                bgr = (0, 100, 200), tag = ("menu", None))

begone.Left = 400 - begone.Width / 2
begone.Top = start.Top + 5 + begone.Height
begone.Command = gone

# The Pause Button
pause = Button(text = "Pause", rect = (0, 0, 150, 60),
               bg = (100, 100, 100), fg = (255, 255, 255),
               bgr = (0, 100, 200), tag = ("game", None))
Пример #2
0
    pygame.display.set_caption("Example Thingy")


# initialize BUTTON

btn = Button(text="YAY",
             rect=(0, 0, 300, 60),
             bg=(100, 100, 100),
             fg=(255, 255, 255),
             bgr=(255, 0, 0),
             tag=("menu", None))
# button coords
btn.Left = 400 - btn.Width / 2
btn.Top = 300 - btn.Height / 2
# the command of the button
btn.Command = testt

create_window()

# mainloop
running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.quit:
            running = False

        # do the button command when you click the thing
        elif event.type == pygame.MOUSEBUTTONDOWN:
            if event.button == 1:  # detect left click
                # do the thing
                for button in Button.All: