本文整理汇总了Python中swampy.Gui.destroy方法的典型用法代码示例。如果您正苦于以下问题:Python Gui.destroy方法的具体用法?Python Gui.destroy怎么用?Python Gui.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类swampy.Gui
的用法示例。
在下文中一共展示了Gui.destroy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: figure8
# 需要导入模块: from swampy import Gui [as 别名]
# 或者: from swampy.Gui import destroy [as 别名]
def figure8():
print 'Figure 17.6'
g = Gui()
options = dict(side=TOP, fill=X)
# create the widgets
g.fr()
la = g.la(side=TOP, text='List of colors:')
lb = g.lb(side=LEFT)
sb = g.sb(side=RIGHT, fill=Y)
g.endfr()
bu = g.bu(side=BOTTOM, text='OK', command=g.quit)
# fill the listbox with color names
colors = []
for line in open('/etc/X11/rgb.txt'):
t = line.split('\t')
name = t[-1].strip()
colors.append(name)
for color in colors:
lb.insert(END, color)
# tell the listbox and the scrollbar about each other
lb.configure(yscrollcommand=sb.set)
sb.configure(command=lb.yview)
g.mainloop()
g.destroy()
示例2: Hwindow
# 需要导入模块: from swampy import Gui [as 别名]
# 或者: from swampy.Gui import destroy [as 别名]
class Hwindow():
"""Creates host/join menu."""
def __init__(self):
self.h = Gui() # make h window
self.h.title('Othello!')
self.h.la(text='Game Name (no spaces)')
self.entryField = self.h.en()
self.h.gr(cols=2)
hostButton = self.h.bu(text='Host Game', command=self.host)
joinButton = self.h.bu(text='Join Game',command=self.join)
self.h.mainloop()
def host(self):
"""Creates a game w/ 2 players and 2 computers."""
name = self.entryField.get()
data = {
'gameName': name
}
req = urllib2.Request('http://othello.herokuapp.com/createGame')
req.add_header('Content-Type', 'application/json')
response = urllib2.urlopen(req, json.dumps(data))
self.h.destroy() # close h window
os.system('python board_piece_final_tweaked1.py ' + name + ' black')
def join(self):
"""Joins an existing game w/ 2 players and 2 computers."""
name = self.entryField.get()
self.h.destroy() # close h window
os.system('python board_piece_final_tweaked1.py ' + name + ' white')
示例3: figure7
# 需要导入模块: from swampy import Gui [as 别名]
# 或者: from swampy.Gui import destroy [as 别名]
def figure7():
print 'Figure 17.5'
g = Gui()
options = dict(side=TOP, fill=X)
b1 = g.bu(text='OK', command=g.quit, **options)
b2 = g.bu(text='Cancel Command', **options)
b3 = g.bu(text='Help', **options)
g.mainloop()
g.destroy()
示例4: Gwindow
# 需要导入模块: from swampy import Gui [as 别名]
# 或者: from swampy.Gui import destroy [as 别名]
class Gwindow():
"""Creates local/internet menu."""
def __init__(self):
self.g = Gui() # make g window
self.g.title('Othello!')
self.g.gr(cols=2)
localButton = self.g.bu(text='Local Game', command=self.local)
internetButton = self.g.bu(text='Internet Game', command=self.internet)
self.g.mainloop()
def local(self):
"""Creates a game w/ 2 players on 1 computer."""
self.g.destroy() # close g window
os.system('python board_piece_final_tweaked.py') # start local game
def internet(self):
"""Leads to next menu."""
self.g.destroy() # close g window
Hwindow()