【发布时间】:2014-05-22 01:29:44
【问题描述】:
我想设置预定义的窗口大小。示例应用:
from tkinter import *
root = Tk()
button = Button(root, text="Example button")
button.pack()
root.mainloop()
生成的窗口非常小。它和按钮一样大。如何让窗口变大?
【问题讨论】:
我想设置预定义的窗口大小。示例应用:
from tkinter import *
root = Tk()
button = Button(root, text="Example button")
button.pack()
root.mainloop()
生成的窗口非常小。它和按钮一样大。如何让窗口变大?
【问题讨论】:
你可以使用几何。
from tkinter import *
root = Tk()
button = Button(root, text="Example button")
button.pack()
root.geometry("200x200")
root.mainloop()
【讨论】:
你可以使用tkinter.Tk.geometry方法:
from tkinter import *
root = Tk()
root.geometry("500x500") # Set the window's size to 500 by 500 pixels
button = Button(root, text="Example button")
button.pack()
root.mainloop()
【讨论】: