本文整理汇总了Python中Gui.mb方法的典型用法代码示例。如果您正苦于以下问题:Python Gui.mb方法的具体用法?Python Gui.mb怎么用?Python Gui.mb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gui
的用法示例。
在下文中一共展示了Gui.mb方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: str
# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import mb [as 别名]
money += bet_placed
money = str(money)
howto.config (text = 'WINNER!!!!!! Press "Play Again!" to play again, or "Back To Lobby"')
betlabel.config (text = 'Your Wager: $ ___')
moneylabel.config (text = 'Your Money: $ ' + money)
else: # Other wise, call the compare function and compare your total to your dealers
compare (total, dtotal)
def destroy (): # Close the main window
g.destroy()
g = Gui() # Make a main "g" window
g.title ("Black Jack") # Title the window
g.row([1,1,1,25])
mb_file = g.mb (text = "File", borderwidth = 0, bg = 'black', fg = 'red') # Create a File drop menu
g.mi (mb_file, text = "Return to Arcade", command = kill)
mb_help = g.mb (text = "Help", borderwidth = 0, bg = 'black', fg = 'yellow') # Create a Help drop menu
g.mi (mb_help, text = "Instructions", command = instructions) #call the instruction function
g.la ("", bg = 'black')
g.endrow()
canvas = g.ca (width = 600, height = 550, bg = "darkgreen") # Create a canvas and draw the background of the main game
g.row ([1, 1])
hit = g.bu (text = "Hit Me!", border = 5, command = hit, state = DISABLED) # Put a Hit Me button
stay = g.bu (text = "Stay!", border = 5, command = stay, state = DISABLED) # Put a Stay button
replay = g.bu (text = "Play Again!", border = 5, command = play_again, state = DISABLED) # Put a Play Again button
示例2: Panel2
# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import mb [as 别名]
class Panel2(Thread):
def __init__(self,field):
Thread.__init__(self)
self.field=field
self.field.panel=self
self.activeCharge=None
self.sel=None
self.g=None
def run(self):
self.g=Gui()
self.g.title('Control Panel')
#charge
self.chgla=self.g.la(text='Charge')
self.g.gr(cols=3)
minus=self.g.bu(text='-', command=Callable(self.addC, -1))
self.chg=self.g.en()
plus=self.g.bu(text='+', command=Callable(self.addC, 1))
self.g.endgr()
#position
self.pos=self.g.la(text='Position')
self.g.gr(cols=3)
xla=self.g.la(text='x')
yla=self.g.la(text='y')
zla=self.g.la(text='z')
self.x=self.g.en(text='')
self.y=self.g.en(text='')
self.z=self.g.en(text='')
self.g.endgr()
#menu
self.men=self.g.mb(text='Change/ Add Charge')
hi=self.g.mi(self.men, text='Add point charge', command=Callable(self.addPoint))
self.g.mi(self.men, text='Add line charge', command=Callable(self.addLine))
self.g.mi(self.men, text='Find voltage at point', command=self.findVolt)
#add
self.g.row([1,1])
self.add=self.g.bu(text='Add')
self.rem=self.g.bu(text='Delete', command=self.remove)
self.g.endrow()
#self.g.bu(text='Quit', command=self.end)
self.disp=self.g.mb(text='Voltage Field')
self.g.mi(self.disp, text='Voltage Field', command=self.showv)
self.g.mi(self.disp, text='Electric Field', command=self.showe)
#ans
self.ans=self.g.la(text='')
self.field.start()
for chrg in self.field.charges:
chrg.makeMi()
self.g.mainloop()
def showv(self):
self.disp.config(text='Voltage Field')
self.actf=self.field.vfield
self.acte=self.field.vdots
self.field.change=True
for p in self.field.earrows:
self.field.earrows[p].visible=False
for p in self.field.vdots:
self.field.vdots[p].visible=True
def showe(self):
self.disp.config(text='Electric Field')
self.field.actf=self.field.efield
self.field.acte=self.field.earrows
self.field.change=True
for p in self.field.earrows:
self.field.earrows[p].visible=True
for p in self.field.vdots:
self.field.vdots[p].visible=False
def addPoint(self):
self.men.config(text='Add Point')
self.pos.config(text='Position')
self.add.config(command=Callable(self.addPCharge))
def addLine(self):
self.men.config(text='Add Line')
self.pos.config(text='Equation in terms of t')
self.add.config(command=Callable(self.addLCharge))
self.field.change=True
def addPCharge(self):
pos=(int(self.x.get()), int(self.y.get()), int(self.z.get()))
c=float(self.chg.get())
p=Point(pos=pos, charge=c)
self.addCharge(p)
def addLCharge(self):
eqn=(self.x.get(), self.y.get(), self.z.get())
dens=self.chg.get()
p=Line(eqn=eqn, density=dens)
self.addCharge(p)
#.........这里部分代码省略.........
示例3: Gui
# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import mb [as 别名]
from Gui import *
g = Gui()
g.title('Gui')
def set_color(color):
mb.config(text=color)
print(color)
g.la('Select a color:')
colors = ['red', 'green', 'blue']
mb = g.mb(text=colors[0])
for color in colors:
g.mi(mb, text=color, command=Callable(set_color, color))
g.mainloop()