当前位置: 首页>>代码示例>>Python>>正文


Python Gui.mainloop方法代码示例

本文整理汇总了Python中Gui.mainloop方法的典型用法代码示例。如果您正苦于以下问题:Python Gui.mainloop方法的具体用法?Python Gui.mainloop怎么用?Python Gui.mainloop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gui的用法示例。


在下文中一共展示了Gui.mainloop方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: grapherCalc

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import mainloop [as 别名]
def grapherCalc(): #Build the Graph Window
    global entry
    global grapher
    global canvas
    try:
        grapher.destroy()
    except:
        error = True #print "DEBUG - NO GRAPHER ENABLED"
    grapher = Gui()
    grapher.minsize(500,550)
    grapher.maxsize(500,550)
    grapher.iconbitmap('icon.ico')
    grapher.title("WinCalc (Equation Grapher)")
    grapher.bind ('<Return>', graphIt)
    grapher.gr(cols=3)
    grapher.la(text="f(x)=")
    entry = grapher.te(width=30,height=1,font=("Courier New", 16))
    entry.insert(0.0,"x**2")
    grapher.bu("Graph It",command=graphIt)
    grapher.endgr()
    canvas = grapher.ca(width=500, height=500, bg='white')
    graphIt()
    tkMessageBox.showinfo(title="WinCalc Equation Grapher - Instructions", message="The equation grapher uses the same syntax as the advanced calculator.\nSyntax errors will result in a blank graph. Radian mode only.")
    entry.focus_set()
    grapher.mainloop()
开发者ID:interwho,项目名称:WinCalc,代码行数:27,代码来源:main.py

示例2: paperTape

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import mainloop [as 别名]
def paperTape(): #Build the Paper Tape Window
    global tapetext
    global papertape
    try:
        papertape.destroy()
    except:
        error = True #print "DEBUG - NO PAPER TAPE"
    papertape = Gui()
    papertape.option_add( "*font", "Arial 9" )
    papertape.minsize(300,400)
    papertape.maxsize(300,400)
    papertape.iconbitmap('icon.ico')
    papertape.title("WinCalc (Paper Tape)")
    menubar = Menu(papertape)
    filemenu = Menu(menubar, tearoff=0)
    filemenu.add_command(label="Save to File", command=saveTape)
    filemenu.add_separator()
    filemenu.add_command(label="Close", command=papertape.destroy)
    menubar.add_cascade(label="File", menu=filemenu)
    editmenu = Menu(menubar, tearoff=0)
    editmenu.add_command(label="Copy All", command=copyButtonp)
    editmenu.add_separator()
    editmenu.add_command(label="Select All", command=selectallButtonp)
    editmenu.add_command(label="Clear Paper Tape", command=clearButtonp)
    menubar.add_cascade(label="Edit", menu=editmenu)
    papertape.config(menu=menubar)
    tapetext = papertape.te(width=280, height=390, padx=2, pady=2, ipadx=2, ipady=2, borderwidth = 1, relief = SUNKEN)
    papertape.mainloop()
开发者ID:interwho,项目名称:WinCalc,代码行数:30,代码来源:main.py

示例3: tableMode

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import mainloop [as 别名]
def tableMode(): #Build the Table Mode Window
    global tableentry
    global tableentrymin
    global tableentrymax
    global tableentrystep
    global tabletext
    global tablemode
    try:
        tablemode.destroy()
    except:
        error = True #print "DEBUG - NO TABLE ENABLED"
    tablemode = Gui()
    tablemode.option_add( "*font", "Arial 9" )
    tablemode.minsize(300,420)
    tablemode.maxsize(300,420)
    tablemode.iconbitmap('icon.ico')
    tablemode.title("WinCalc (Table Mode)")
    menubar = Menu(tablemode)
    filemenu = Menu(menubar, tearoff=0)
    filemenu.add_command(label="Save to File", command=saveTable)
    filemenu.add_separator()
    filemenu.add_command(label="Close", command=tablemode.destroy)
    menubar.add_cascade(label="File", menu=filemenu)
    editmenu = Menu(menubar, tearoff=0)
    editmenu.add_command(label="Copy All", command=copyButtont)
    editmenu.add_separator()
    editmenu.add_command(label="Select All", command=selectallButtont)
    editmenu.add_command(label="Clear Table", command=clearButtont)
    menubar.add_cascade(label="Edit", menu=editmenu)
    tablemode.config(menu=menubar)
    tablemode.gr(cols=2)
    tablemode.la(text="f(x)=")
    tableentry = tablemode.te(width=20,height=1,font=("Courier New", 16))
    tablemode.la(text="MIN=")
    tableentrymin = tablemode.te(width=20,height=1,font=("Courier New", 16))
    tablemode.la(text="MAX=")
    tableentrymax = tablemode.te(width=20,height=1,font=("Courier New", 16))
    tablemode.la(text="STEP")
    tableentrystep = tablemode.te(width=20,height=1,font=("Courier New", 16))
    tablemode.endgr()
    tablemode.gr(cols=1)
    tablemode.bu("Get Table of Values",command=tableIt)
    tablemode.endgr()
    tabletext = tablemode.te(width=280, height=390, padx=2, pady=2, ipadx=2, ipady=2, borderwidth = 1, relief = SUNKEN)
    tkMessageBox.showinfo(title="WinCalc Table Mode - Instructions", message="The table of values generator uses the same syntax as the advanced calculator. Radian mode only.")
    tablemode.mainloop()
开发者ID:interwho,项目名称:WinCalc,代码行数:48,代码来源:main.py

示例4: display

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import mainloop [as 别名]
def display():
	def display_QR():
		qr_bitstring = polynomials.QRbitstring(entry.get().upper())
		i = 0
		for i in range(8):
			canvas = mygui.ca(width=300, height=300)
			canvas.config(bg='white')
			g = Mask(i, qr_bitstring)
			g.drawSquares(canvas)
	

	g = Mask(0, qr_bitstring)

	mygui = Gui()
	mygui.title('QR Encoder')
	label = mygui.la(text='Enter the text to encode here:')
	entry = mygui.en()
	button = mygui.bu(text='Make QR Code', command=display_QR)
	mygui.gr(cols=4)
	mygui.mainloop()
开发者ID:JNazare,项目名称:QR_Encoder,代码行数:22,代码来源:QR_with_classes.py

示例5: Gui

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import mainloop [as 别名]
from Gui import *

g = Gui()
g.title('Gui')
g.mainloop()
开发者ID:BethWIntera,项目名称:Beths_PySandbox,代码行数:7,代码来源:Gui+Sample.py

示例6: Callable

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import mainloop [as 别名]
nine = cal.bu(text='9',command = Callable(insert,'9'))
div = cal.bu(text='/',command = Callable(insert,'/'))

#bspace = cal.bu(text='Del',command = Callable(delete,0))
bspace = cal.bu(text='Del',command = Callable(delete,len(cal_in.get())-1))

clr = cal.bu(text='Clr',command = Callable(delete,'7'))

four = cal.bu(text='4',command = Callable(insert,'4'))
five = cal.bu(text='5',command = Callable(insert,'5'))
six = cal.bu(text='6',command = Callable(insert,'6'))
mul = cal.bu(text='*',command = Callable(insert,'*'))
lbra = cal.bu(text='(',command = Callable(insert,'('))
rbra = cal.bu(text=')',command = Callable(insert,')'))

one = cal.bu(text='1',command = Callable(insert,'1'))
two = cal.bu(text='2',command = Callable(insert,'2'))
three = cal.bu(text='3',command = Callable(insert,'3'))
minus = cal.bu(text='-',command = Callable(insert,'-'))
sqr = cal.bu(text='sqr(x)',command = Callable(insert,'7'))
sroot = cal.bu(text='sqrt(x)',command = Callable(insert,'7'))

zero = cal.bu(text='0',command = Callable(insert,'0'))
dot = cal.bu(text='.',command = Callable(insert,'.'))
per = cal.bu(text='%',command = Callable(insert,'%'))
plus = cal.bu(text='+',command = Callable(insert,'+'))
equal = cal.bu(text='=',command = Callable(insert,'='))


cal.mainloop()
开发者ID:binoytv9,项目名称:Think-Python-by-Allen-B-Downey--Exercises,代码行数:32,代码来源:cal.py

示例7: Panel2

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import mainloop [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

示例8: Gui

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import mainloop [as 别名]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Gui import *

gu = Gui()
gu.title('Titletitletitle')
gu.la(text='Press the bt 1')


def create_button():
	gu.bu(text='bt 2', command=change_label)


def change_label():
	gu.la(text='Label')


gu.bu(text='bt 1', command=create_button)
gu.mainloop()

开发者ID:lafabo,项目名称:i-love-tutorials,代码行数:21,代码来源:19.1-button.py

示例9: str

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import mainloop [as 别名]
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()

g.row ([1,25])
bet = g.bu (text = "Place Bet!", border = 5, command = place_bet)       # Put in a place bet button
text = g.te (height = 1, width = 25, fg = 'darkgreen')                  # Create a text box to type the bet in
text.bind ('<Return>', place_bet)       # Bind the enter key with the place bet function
g.endrow()

howto = g.la ('Enter the amount you wish to bet and click "Place Bet!".', bg = 'black', fg = 'yellow')      # Make a label at the bottom to instruct the user on how to play
betlabel = g.la ('Your Wager: $ ___', bg = 'black', fg = 'green')   # Make a label that displays your wager
money = str(money)
moneylabel = g.la ('Your Money: $ ' + money, bg = 'black', fg = 'green')        # Make a label that displays 

play_again() # Initialize the game

g.mainloop()    # Loop the window
开发者ID:Couragyn,项目名称:BlackJack,代码行数:31,代码来源:Working+Blackjack.py

示例10: advCalc

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import mainloop [as 别名]

#.........这里部分代码省略.........
    editmenu.add_command(label="Select All (Ctrl-A)", command=selectallButton)
    editmenu.add_command(label="Clear Equation", command=clearButton)
    menubar.add_cascade(label="Edit", menu=editmenu)
    goodies = Menu(menubar, tearoff=0)
    goodies.add_command(label="Equation Grapher", command=grapherCalc)
    goodies.add_command(label="Table of Values Generator", command=tableMode)
    goodies.add_separator()
    goodies.add_command(label="Show Paper Tape", command=paperTape)
    menubar.add_cascade(label="Goodies", menu=goodies)
    helpmenu = Menu(menubar, tearoff=0)
    helpmenu.add_command(label="Instructions - Basic Mode", command=basicDialog)
    helpmenu.add_command(label="Instructions - Advanced Mode", command=advDialog)
    helpmenu.add_separator()
    helpmenu.add_command(label="About", command=aboutDialog)
    menubar.add_cascade(label="Help", menu=helpmenu)
    window.config(menu=menubar)
    window.row()
    display = window.te(width=10, height=2, padx=2, pady=2, ipadx=2, ipady=2, borderwidth = 1, relief = SUNKEN, font=("Courier New", 16))
    window.endrow()
    window.row(pady=5,padx=5)
    window.gr(cols=5)
    ###BEGIN BUTTONS###
    mrc = window.bu(text='MRC',width=5,command=memRc)
    window.bu(text='M+',width=5,command=amemPlus)
    window.bu(text='M-',width=5,command=amemMinus)
    window.bu(text='DEL',width=5,command=delButton)
    window.bu(text='AC',width=5,command=clearDisplay)
    ######BEGIN ADVANCED FUNCTIONS#######
    window.la(dmode)
    window.bu(text='1/x',width=5,command=Callable(buttonPress,'1/('))
    window.bu(text='x^x',width=5,command=Callable(buttonPress,'**'))
    window.bu(text='x^2',width=5,command=Callable(buttonPress,'**2'))
    window.bu(text='π',width=5,command=Callable(buttonPress,'(3.14159265359)'))
    ##
    window.bu(text='sin^-1',width=5,command=Callable(buttonPress,'sin^-1('))
    window.bu(text='cos^-1',width=5,command=Callable(buttonPress,'cos^-1('))
    window.bu(text='tan^-1',width=5,command=Callable(buttonPress,'tan^-1('))
    window.bu(text='sinh',width=5,command=Callable(buttonPress,'sinh('))
    window.bu(text='sinh^-1',width=5,command=Callable(buttonPress,'sinh^-1('))
    ##
    window.bu(text='sin',width=5,command=Callable(buttonPress,'sin('))
    window.bu(text='cos',width=5,command=Callable(buttonPress,'cos('))
    window.bu(text='tan',width=5,command=Callable(buttonPress,'tan('))
    window.bu(text='cosh',width=5,command=Callable(buttonPress,'cosh('))
    window.bu(text='cosh^-1',width=5,command=Callable(buttonPress,'cosh^-1('))
    ##
    window.bu(text='DEG(x)',width=5,command=Callable(buttonPress,'degrees('))
    window.bu(text='RAD(x)',width=5,command=Callable(buttonPress,'radians('))
    window.bu(text='Ran#',width=5,command=Callable(buttonPress,'Ran#'))
    window.bu(text='tanh',width=5,command=Callable(buttonPress,'tanh('))
    window.bu(text='tanh^-1',width=5,command=Callable(buttonPress,'tanh^-1('))
    ##
    window.bu(text='DICE',width=5,command=diceRoll)
    window.bu(text='D->BIN',width=5,command=binConvert)
    window.bu(text='D->OCT',width=5,command=octConvert)
    window.bu(text='D->HEX',width=5,command=hexConvert)
    window.bu(text='x(2)√x(1)',width=5,command=Callable(buttonPress,'**(1.0/'))
    ##
    window.bu(text='(',width=5,command=Callable(buttonPress,'('))
    window.bu(text=')',width=5,command=Callable(buttonPress,')'))
    window.bu(text='x!',width=5,command=Callable(buttonPress,'!('))
    window.bu(text='ln(x)',width=5,command=Callable(buttonPress,'ln('))
    window.bu(text='e^x',width=5,command=Callable(buttonPress,'(2.71828182846)**'))
    ###END ADVANCED FUNCTIONS###
    window.bu(text='7',width=5,command=Callable(buttonPress,7))
    window.bu(text='8',width=5,command=Callable(buttonPress,8))
    window.bu(text='9',width=5,command=Callable(buttonPress,9))
    window.bu(text='%',width=5,command=Callable(buttonPress,'*0.01'))
    window.bu(text='+/-',width=5,command=Callable(buttonPress,'*-1'))
    ##
    window.bu(text='4',width=5,command=Callable(buttonPress,4))
    window.bu(text='5',width=5,command=Callable(buttonPress,5))
    window.bu(text='6',width=5,command=Callable(buttonPress,6))
    window.bu(text='×',width=5,command=Callable(buttonPress,'*'))
    window.bu(text='÷',width=5,command=Callable(buttonPress,'/'))
    ##
    window.bu(text='1',width=5,command=Callable(buttonPress,1))
    window.bu(text='2',width=5,command=Callable(buttonPress,2))
    window.bu(text='3',width=5,command=Callable(buttonPress,3))
    window.bu(text='+',width=5,command=Callable(buttonPress,'+'))
    window.bu(text='−',width=5,command=Callable(buttonPress,'-'))
    ##
    window.bu(text='0',width=5,command=Callable(buttonPress,0))
    window.bu(text='.',width=5,command=Callable(buttonPress,'.'))
    window.bu(text='Ans',width=5,command=prevAns)
    window.bu(text='√',width=5,command=Callable(buttonPress,'sqrt('))
    window.bu(text='=',width=5,command=solveAdv)
    ###END BUTTONS###
    window.endgr()
    window.endrow()
    display.focus_set()
    window.mainloop()
    try:
        papertape.destroy()
    except:
        error = True #print "DEBUG - NO PAPER TAPE ENABLED"
    try:
        grapher.destroy()
    except:
        error = True #print "DEBUG - NO GRAPHER ENABLED"
开发者ID:interwho,项目名称:WinCalc,代码行数:104,代码来源:main.py

示例11: basicCalc

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import mainloop [as 别名]
def basicCalc(): #Basic Calculator
    global window
    global display
    global prevans
    global mrc
    prevans = ''
    window.destroy()
    window = Gui()
    window.option_add( "*font", "Arial 9" ) 
    window.minsize(300,240)
    window.maxsize(300,240)
    window.iconbitmap('icon.ico')
    window.title("WinCalc (Basic Mode)")
    window.bind('<Return>', solveEqn)
    window.bind('<Control-a>', selectallButton)
    window.bind('<Control-A>', selectallButton)
    window.bind('<Control-v>', pasteButton)
    window.bind('<Control-V>', pasteButton)
    window.bind('<Control-e>', copyButton)
    window.bind('<Control-E>', copyButton)
    menubar = Menu(window)
    filemenu = Menu(menubar, tearoff=0)
    filemenu.add_command(label="Advanced Mode", command=advCalc)
    filemenu.add_command(label="Reset Calculator", command=basicCalc)
    filemenu.add_separator()
    filemenu.add_command(label="Exit", command=exitProgram)
    menubar.add_cascade(label="File", menu=filemenu)
    editmenu = Menu(menubar, tearoff=0)
    editmenu.add_command(label="Undo", command=undoButton)
    editmenu.add_separator()
    editmenu.add_command(label="Cut Equation", command=cutButton)
    editmenu.add_command(label="Copy Equation (Ctrl-E)", command=copyButton)
    editmenu.add_command(label="Paste Equation (Ctrl-V)", command=pasteButton)
    editmenu.add_separator()
    editmenu.add_command(label="Select All (Ctrl-A)", command=selectallButton)
    editmenu.add_command(label="Clear Equation", command=clearButton)
    menubar.add_cascade(label="Edit", menu=editmenu)
    goodies = Menu(menubar, tearoff=0)
    goodies.add_command(label="Equation Grapher", command=grapherCalc)
    goodies.add_command(label="Table of Values Generator", command=tableMode)
    goodies.add_separator()
    goodies.add_command(label="Show Paper Tape", command=paperTape)
    menubar.add_cascade(label="Goodies", menu=goodies)
    helpmenu = Menu(menubar, tearoff=0)
    helpmenu.add_command(label="Instructions - Basic Mode", command=basicDialog)
    helpmenu.add_command(label="Instructions - Advanced Mode", command=advDialog)
    helpmenu.add_separator()
    helpmenu.add_command(label="About", command=aboutDialog)
    menubar.add_cascade(label="Help", menu=helpmenu)
    window.config(menu=menubar)
    window.row()
    display = window.te(width=10, height=2, padx=2, pady=2, ipadx=2, ipady=2, borderwidth = 1, relief = SUNKEN, font=("Courier New", 16))
    window.endrow()
    window.row(pady=5,padx=5)
    window.gr(cols=5)
    mrc = window.bu(text='MRC',width=5,command=memRc)
    window.bu(text='M+',width=5,command=memPlus)
    window.bu(text='M-',width=5,command=memMinus)
    window.bu(text='DEL',width=5,command=delButton)
    window.bu(text='AC',width=5,command=clearDisplay)
    window.bu(text='7',width=5,command=Callable(buttonPress,7))
    window.bu(text='8',width=5,command=Callable(buttonPress,8))
    window.bu(text='9',width=5,command=Callable(buttonPress,9))
    window.bu(text='%',width=5,command=percentButton)
    window.bu(text='+/-',width=5,command=plusMinus)
    window.bu(text='4',width=5,command=Callable(buttonPress,4))
    window.bu(text='5',width=5,command=Callable(buttonPress,5))
    window.bu(text='6',width=5,command=Callable(buttonPress,6))
    window.bu(text='×',width=5,command=Callable(buttonPress,'*'))
    window.bu(text='÷',width=5,command=Callable(buttonPress,'/'))
    window.bu(text='1',width=5,command=Callable(buttonPress,1))
    window.bu(text='2',width=5,command=Callable(buttonPress,2))
    window.bu(text='3',width=5,command=Callable(buttonPress,3))
    window.bu(text='+',width=5,command=Callable(buttonPress,'+'))
    window.bu(text='−',width=5,command=Callable(buttonPress,'-'))
    window.bu(text='0',width=5,command=Callable(buttonPress,0))
    window.bu(text='.',width=5,command=Callable(buttonPress,'.'))
    window.bu(text='Ans',width=5,command=prevAns)
    window.bu(text='√',width=5,command=squareRoot)
    window.bu(text='=',width=5,command=solveEqn)
    window.endgr()
    window.endrow()
    display.focus_set()
    window.mainloop()
    try:
        papertape.destroy()
    except:
        error = True #print "DEBUG - NO PAPER TAPE ENABLED"
    try:
        grapher.destroy()
    except:
        error = True #print "DEBUG - NO GRAPHER ENABLED"
开发者ID:interwho,项目名称:WinCalc,代码行数:94,代码来源:main.py

示例12:

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import mainloop [as 别名]
    main_window.la('    ')
    main_window.bu(text='Calculate Attenuation and ABV', command=results_controller)
    main_window.la('    ')
    main_window.endgr()
    main_window.la('')
    main_window.gr(cols=3)
    main_window.la('Attenuation:')
    attenuation = main_window.en(text='')
    main_window.la('    ')
    main_window.la('Alcohol By Volume:')
    abv = main_window.en(text='')
    main_window.la('    ')
    main_window.endgr()
    main_window.la('')

    main_window.mainloop()
else:
    print 'type \'q\' or \'quit\' to quit'
    while True:
        original_gravity = raw_input('Original Gravity: ')
        if original_gravity[0].lower() == 'q':
            break
        final_gravity = raw_input('Ending Gravity: ')
        if final_gravity[0].lower() == 'q':
            break
        print ''
        try:
            print 'Attenuation: ' + calculate_attenuation(original_gravity,final_gravity)
            print 'Alcohol by Volume: ' + calculate_abv(original_gravity,final_gravity) + '\n'
        except:
            print 'Error with your inputs\n'
开发者ID:mjbondra,项目名称:python-abv-calculator,代码行数:33,代码来源:abv.py


注:本文中的Gui.mainloop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。