當前位置: 首頁>>代碼示例>>Python>>正文


Python Gui.mi方法代碼示例

本文整理匯總了Python中Gui.mi方法的典型用法代碼示例。如果您正苦於以下問題:Python Gui.mi方法的具體用法?Python Gui.mi怎麽用?Python Gui.mi使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Gui的用法示例。


在下文中一共展示了Gui.mi方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: str

# 需要導入模塊: import Gui [as 別名]
# 或者: from Gui import mi [as 別名]
        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
g.endrow()
開發者ID:Couragyn,項目名稱:BlackJack,代碼行數:33,代碼來源:Working+Blackjack.py

示例2: Panel2

# 需要導入模塊: import Gui [as 別名]
# 或者: from Gui import mi [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)


#.........這裏部分代碼省略.........
開發者ID:berit,項目名稱:Project-E-and-M,代碼行數:103,代碼來源:control.py

示例3: Gui

# 需要導入模塊: import Gui [as 別名]
# 或者: from Gui import mi [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()
開發者ID:ErikRHanson,項目名稱:think_python,代碼行數:19,代碼來源:sec07_menus_and_callables.py


注:本文中的Gui.mi方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。