Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # testing out gtk with python simple dial pad
- import gtk
- myWindow = gtk.Window() #create the window
- myWindow.connect('destroy', lambda w: gtk.main_quit()) #make pid end after closing gui
- guiBox = gtk.VBox() #the box
- myWindow.add(guiBox) #add box to the window
- entry = gtk.Entry() #text field
- guiBox.pack_start(entry) #add textfield to the box
- table = gtk.Table(2,2, gtk.TRUE) #create table 3x3
- padArray = [1,2,3,4,5,6,7,8,9,"#",0,"*"] #initialize pad numbers
- x = 0
- y = 0
- for i in padArray: #lets place the buttons
- button = gtk.Button(str(i))
- table.attach(button,x,x+1,y,y+1)
- x+=1
- if x > 2:
- x = 0
- y+=1
- guiBox.pack_start(table) #add table to the box
- myWindow.show_all() #show box and all inside
- gtk.main() #main lewp
Advertisement
Add Comment
Please, Sign In to add comment