本文整理汇总了Python中Tkinter.Tk.columnconfigure方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.columnconfigure方法的具体用法?Python Tk.columnconfigure怎么用?Python Tk.columnconfigure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter.Tk
的用法示例。
在下文中一共展示了Tk.columnconfigure方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_pixels
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import columnconfigure [as 别名]
def get_pixels():
root = Tk()
root.title("Pixel Printer")
root.grid()
inner_top = Frame(root)
inner_top.grid(row=0, column=0)
t1 = Entry(inner_top, width = 40)
t2 = Entry(inner_top, width = 40)
v = StringVar()
root.columnconfigure(0, weight=1)
root.columnconfigure(1, weight=1)
b1 = Button(inner_top, text = "Source")
b2 = Button(inner_top, text = "Dest")
b3 = Button(inner_top, text = "Calc")
b1.configure(command= lambda:get_source(t1))
b2.configure(command= lambda:get_dest(t2))
b3.configure(command= lambda:calculate(t1, t2, v))
t1.grid(row=0, column=0)
b1.grid(row=0, column=1, sticky=E+W)
t2.grid(row=1, column=0)
b2.grid(row=1, column=1, sticky=E+W)
b3.grid(row=2, column=1, sticky=E+W)
root.mainloop()
示例2: main
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import columnconfigure [as 别名]
def main(config=config):
"""
Creates an application instance.
"""
root = Tk()
root.columnconfigure(0, weight=1)
root.wm_title("ayy lmap")
app = Application(master=root, config=config)
return app
示例3: test_frame
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import columnconfigure [as 别名]
def test_frame():
c = Customers()
p = Payments()
root = Tk()
rf = ReportsFrame(root,c,p,output_text)
rf.grid(sticky='nsew')
root.rowconfigure(0,weight=1)
root.columnconfigure(0,weight=1)
root.mainloop()
示例4: testFrame
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import columnconfigure [as 别名]
def testFrame():
c = Customers()
p = Payments()
root = Tk()
pf = PaymentFrame(root, c, p, output_text, refresh)
pf.grid(sticky='nsew')
root.rowconfigure(0,weight=1)
root.columnconfigure(0,weight=1)
root.mainloop()
示例5: run
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import columnconfigure [as 别名]
def run():
""" starting the interface
"""
from gui import GUI
from Tkinter import Tk
import system
root = Tk()
root.columnconfigure(0,weight=1)
root.rowconfigure(1,weight=1)
root.title(system.name + " " + system.version)
root.minsize(width= system.minwidth , height=system.minheight)
root.geometry(system.defsize)
gui = GUI(root)
gui.makeGUI()
root.iconbitmap('hat2.ico')
root.mainloop()
示例6: output_text
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import columnconfigure [as 别名]
NewCustomerDialog.add_customer(self,event)
if self.close:
self.output_text("+ - Modified: " + name + " (" + self.payment.get() + ")\n")
def output_text(text):
print text,
def refresh():
print "refreshing...."
if __name__ == '__main__':
c = Customers()
pprint(c.get_list())
root = Tk()
ncf = CustomerFrame(root, c, output_text, refresh)
ncf.grid(sticky='nsew')
root.rowconfigure(0,weight=1)
root.columnconfigure(0,weight=1)
root.mainloop()
# c = Customers()
# pprint(c.get_list())
# root = Frame()
# ncd = NewCustomerDialog(root, c)
# Button(root,text='New Customer',command=ncd.show).pack()
# root.pack()
# root.mainloop()
示例7: editSettings
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import columnconfigure [as 别名]
def editSettings(cls):
def commitSettings(messageInDialogIn):
# Temp vars
ip = settings.serverIp
p = settings.port
settingsVars.serverIp = IPAddressBox.get()
settingsVars.port = portBox.get()
settingsVars.numberOfMessagesToGet = int(numberToGetBox.get())
settingsVars.refreshInterval = int(refreshIntervalBox.get())
if not cls.isServerActive():
settingsVars.serverIp = ip
settingsVars.port = p
tkMessageBox.showerror(message='Invalid Server Address ' + 'http://' + IPAddressBox.get() + ':' + portBox.get() + '/')
logging.warning('Invalid Server Address ' + 'http://' + IPAddressBox.get() + ':' + portBox.get() + '/')
messageInDialogIn.destroy()
settingsDialog = Tk()
settingsDialog.title('Settings')
if os.name == "nt":
settingsDialog.wm_iconbitmap(bitmap='images/icon.ico')
settingsDialog.columnconfigure(0, weight=1)
settingsDialog.rowconfigure(0, weight=1)
settingsDialog.minsize(width=100, height=50)
frame = Frame(settingsDialog)
addressLabel = Label(frame)
addressLabel['text'] = 'Server Address'
addressLabel.pack()
IPAddressBox = Entry(frame)
IPAddressBox.insert(0, cls.serverIp)
IPAddressBox.pack(fill='both')
portLabel = Label(frame)
portLabel['text'] = 'Server Port'
portLabel.pack()
portBox = Entry(frame)
portBox.insert(0, cls.port)
portBox.pack(fill='both')
numberToGetLabel = Label(frame)
numberToGetLabel['text'] = '# of Messages To Get'
numberToGetLabel.pack()
numberToGetBox = Entry(frame)
numberToGetBox.insert(0, cls.numberOfMessagesToGet)
numberToGetBox.pack(fill='both')
refreshIntervalLabel = Label(frame)
refreshIntervalLabel['text'] = 'Refresh Interval'
refreshIntervalLabel.pack()
refreshIntervalBox = Entry(frame)
refreshIntervalBox.insert(0, cls.refreshInterval)
refreshIntervalBox.pack(fill='both')
submitButton = Button(frame)
submitButton['text'] = 'Ok'
submitButton['command'] = lambda: commitSettings(settingsDialog)
submitButton.pack(side="left", expand="yes", fill="both", padx=5, pady=3)
cancelButton = Button(frame)
cancelButton['text'] = 'Cancel'
cancelButton['command'] = settingsDialog.destroy
cancelButton.pack(fill='both', expand="yes", padx=5, pady=3)
frame.pack(fill='both', expand="yes", padx=0, pady=0)
return settingsDialog
示例8: __init__
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import columnconfigure [as 别名]
class GUI:
def __init__(self, model, title='PyCX Simulator', interval=0, stepSize=1,
param_gui_names=None):
self.model = model
self.titleText = title
self.timeInterval = interval
self.stepSize = stepSize
self.param_gui_names = param_gui_names
if param_gui_names is None:
self.param_gui_names = {}
self.param_entries = {}
self.statusStr = ""
self.running = False
self.modelFigure = None
self.currentStep = 0
self.initGUI()
def initGUI(self):
#create root window
self.rootWindow = Tk()
self.statusText = StringVar(value=self.statusStr)
self.setStatusStr("Simulation not yet started")
self.rootWindow.wm_title(self.titleText)
self.rootWindow.protocol('WM_DELETE_WINDOW', self.quitGUI)
self.rootWindow.geometry('550x700')
self.rootWindow.columnconfigure(0, weight=1)
self.rootWindow.rowconfigure(0, weight=1)
self.frameSim = Frame(self.rootWindow)
self.frameSim.pack(expand=YES, fill=BOTH, padx=5, pady=5, side=TOP)
self.status = Label(self.rootWindow, width=40, height=3, relief=SUNKEN,
bd=1, textvariable=self.statusText)
self.status.pack(side=TOP, fill=X, padx=1, pady=1, expand=NO)
self.runPauseString = StringVar()
self.runPauseString.set("Run")
self.buttonRun = Button(self.frameSim, width=30, height=2,
textvariable=self.runPauseString,
command=self.runEvent)
self.buttonRun.pack(side=TOP, padx=5, pady=5)
self.showHelp(self.buttonRun,
"Runs the simulation (or pauses the running simulation)")
self.buttonStep = Button(self.frameSim, width=30, height=2,
text="Step Once", command=self.stepOnce)
self.buttonStep.pack(side=TOP, padx=5, pady=5)
self.showHelp(self.buttonStep, "Steps the simulation only once")
self.buttonReset = Button(self.frameSim, width=30, height=2,
text="Reset", command=self.resetModel)
self.buttonReset.pack(side=TOP, padx=5, pady=5)
self.showHelp(self.buttonReset, "Resets the simulation")
for param in self.model.params:
var_text = self.param_gui_names.get(param, param)
can = Canvas(self.frameSim)
lab = Label(can, width=25, height=1 + var_text.count('\n'),
text=var_text, anchor=W, takefocus=0)
lab.pack(side='left')
ent = Entry(can, width=11)
val = getattr(self.model, param)
if isinstance(val, bool):
val = int(val) # Show 0/1 which can convert back to bool
ent.insert(0, str(val))
ent.pack(side='left')
can.pack(side='top')
self.param_entries[param] = ent
if self.param_entries:
self.buttonSaveParameters = Button(self.frameSim, width=50,
height=1, command=self.saveParametersCmd,
text="Save parameters to the running model", state=DISABLED)
self.showHelp(self.buttonSaveParameters,
"Saves the parameter values.\n" +
"Not all values may take effect on a running model\n" +
"A model reset might be required.")
self.buttonSaveParameters.pack(side='top', padx=5, pady=5)
self.buttonSaveParametersAndReset = Button(self.frameSim, width=50,
height=1, command=self.saveParametersAndResetCmd,
text="Save parameters to the model and reset the model")
self.showHelp(self.buttonSaveParametersAndReset,
"Saves the given parameter values and resets the model")
self.buttonSaveParametersAndReset.pack(side='top', padx=5, pady=5)
can = Canvas(self.frameSim)
lab = Label(can, width=25, height=1, text="Step size ", justify=LEFT,
anchor=W, takefocus=0)
lab.pack(side='left')
self.stepScale = Scale(can, from_=1, to=500, resolution=1,
command=self.changeStepSize, orient=HORIZONTAL,
width=25, length=150)
self.stepScale.set(self.stepSize)
self.showHelp(self.stepScale,
"Skips model redraw during every [n] simulation steps\n" +
"Results in a faster model run.")
self.stepScale.pack(side='left')
can.pack(side='top')
can = Canvas(self.frameSim)
#.........这里部分代码省略.........
示例9: Tk
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import columnconfigure [as 别名]
if gameinstance.is_gameover():
if gameinstance.winner == self.marker:
return 1 # Won
elif gameinstance.winner == self.opponentmarker:
return -1 # Opponent won
return 0 # Draw
########################################################################
master = Tk()
master.title("TIC TAC TOE :")
master.style = Style()
master.configure("TButton", padding=(0, 30, 0, 30),font='serif 10')
master.configure("TFrame", background="#786")
master.columnconfigure(0, pad=3)
master.columnconfigure(1, pad=3)
master.columnconfigure(2, pad=3)
master.rowconfigure(0, pad=3)
master.rowconfigure(1, pad=3)
master.rowconfigure(2, pad=3)
master.rowconfigure(3, pad=3)
entry = Entry(self)
entry.grid(row=0, columnspan=4, sticky=W+E)
T1 = Button(self, text="_")
T1.grid(row=1, column=0)
T2 = Button(self, text="_")
T2.grid(row=1, column=1)