Exemple #1
0
    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))
b7 =  Button(height = 32, width=32, text = "")
Exemple #2
0
    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="")
link(b7, makeMove(6))
Exemple #3
0
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)