Skip to content

Simple Code (Delphi style)

kuko0411 edited this page Jan 5, 2013 · 6 revisions
import gui, pygame                                          #import the library
screen = gui.screen.Screen ((1000, 1000))                   #Get the drawing surface

class Button1(gui.button.Button):                           #define new button
    def  __init__ (self):                                   #Python method called on creating
        gui.button.Button.__init__ (self, parent = None)    #Call parent constructor
        self.topleft = (20, 50)                             #move the button on right place
        self.size    = (200, 420)
        self.caption = "Do something"

    def onMouseButtonUp (self, event):                      #define what happens on click
        self.caption = "Done something"
button1 = Button1()                                         #construct the button

gui.loop()                                                  #run the gui
Clone this wiki locally