def print_contents(event): global tf log('Enter was pressed. Field contents:', tf.text) tf = TextField(width=150, height=25) link(tf, print_contents) tf.text = '' tf2 = TextField(width=150, height=25, editable=0) tf2.text = 'Edit me... :P' lbl = Label(width = 150, height=25, text = 'I Am A LABEL') update_btn = Button(width=50, height=30, text='Update') link(update_btn, update_label) reset_btn = Button(height=30, text='Reset') link(reset_btn, init_field) win = Window(title='TextField test', width=200, height=245) app.add(win) win.add([tf, tf2, lbl], left=25, right=25, top=40, hstretch=1, direction='down', space=20) win.add([reset_btn, update_btn], right=25, bottom=25, vmove=1, hmove=1, direction='left', space=25) init_field() update_label() app.run()
l1.text = "Thinking..." b = int(uniform(0, 9)) while btns[b].text != "": b = int(uniform(0, 9)) btns[b].text = "o" if checkWin(): return l1.text = "Your move..." app = Application() win = Window(width=200, height=400) win.layout = SimpleGridManager(3, 4) b1 = Button(height=32, width=32, text="") link(b1, makeMove(0)) b2 = Button(height=32, width=32, text="") link(b2, makeMove(1)) b3 = Button(height=32, width=32, text="") link(b3, makeMove(2)) b4 = Button(height=32, width=32, text="") link(b4, makeMove(3)) b5 = Button(height=32, width=32, text="") link(b5, makeMove(4)) b6 = Button(height=32, width=32, text="") link(b6, makeMove(5)) b7 = Button(height=32, width=32, text="")
return l1.text = "Thinking..." b = int(uniform(0,9)) while btns[b].text != "": b = int(uniform(0,9)) btns[b].text = "o" if checkWin(): return l1.text = "Your move..." app = Application() win = Window(width = 180, height = 180) win.layout = GridManager(3) app.add(win) b1 = Button(height = 32, width=32, text = "") link(b1,makeMove(0)) b2 = Button(height = 32, width=32, text = "") link(b2,makeMove(1)) b3 = Button(height = 32, width=32, text = "") link(b3,makeMove(2)) b4 = Button(height = 32, width=32, text = "") link(b4,makeMove(3)) b5 = Button(height = 32, width=32, text = "") link(b5,makeMove(4)) b6 = Button(height = 32, width=32, text = "") link(b6,makeMove(5))
return l1.text = "Thinking..." b = int(uniform(0,9)) while btns[b].text != "": b = int(uniform(0,9)) btns[b].text = "o" if checkWin(): return l1.text = "Your move..." app = Application() win = Window(width = 160, height = 250) win.layout = SimpleGridManager(3,4) app.add(win) b1 = Button(height = 32, width=32, text = "") link(b1, makeMove(0)) b2 = Button(height = 32, width=32, text = "") link(b2, makeMove(1)) b3 = Button(height = 32, width=32, text = "") link(b3, makeMove(2)) b4 = Button(height = 32, width=32, text = "") link(b4, makeMove(3)) b5 = Button(height = 32, width=32, text = "") link(b5, makeMove(4)) b6 = Button(height = 32, width=32, text = "") link(b6, makeMove(5))
from manygui import Application, Window, MenuBar, Menu, MenuCheck, Label, link, TextField from manygui.LayoutManagers import SimpleGridManager app = Application() win = Window(title='Menu Example', geometry=(50,50,100,100)) win.layout = SimpleGridManager(1,2) # A menubar for the window. mbar = MenuBar() win.addMenu(mbar) # A menu to choose skits. skitMenu = Menu(text="Skit") mbar.add(skitMenu) # Populate the skit menu. lbl = Label(text="No skit selected") win.add(lbl) def chooseSkit(ev): # Handle a skit choice. A menu event should have a # 'text' property containing the text of the menu item. lbl.text = ev.text # The objects returned by the add...() calls are handles that permit # us to operate on the menu items later. dedPrt = skitMenu.addCommand(text="Dead Parrot") pengTv = skitMenu.addCommand(text="Penguin on the Telly") link(dedPrt,chooseSkit) link(pengTv,chooseSkit)
from manygui import Window, Label, Application from manygui.Utils import log app = Application() win = Window(width = 160, height = 100) app.add(win) lb1 = Label(x = 30, y = 18, height = 32, text = "Spam!") lb2 = Label(x = 30, y = 58, height = 32, text = "Glorious Spam!") win.add(lb1) win.add(lb2) app.run()