本文整理汇总了Python中tkinter.Tk.winfo_reqheight方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.winfo_reqheight方法的具体用法?Python Tk.winfo_reqheight怎么用?Python Tk.winfo_reqheight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Tk
的用法示例。
在下文中一共展示了Tk.winfo_reqheight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_gui
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import winfo_reqheight [as 别名]
def draw_gui(self):
main = Tk()
main.title('KindleButler ' + __version__)
main.resizable(0, 0)
main.wm_attributes('-toolwindow', 1)
x = (main.winfo_screenwidth() - main.winfo_reqwidth()) / 2
y = (main.winfo_screenheight() - main.winfo_reqheight()) / 2
main.geometry('+%d+%d' % (x, y))
progressbar = ttk.Progressbar(orient='horizontal', length=200, mode='determinate')
progressbar.grid(row=0)
style = ttk.Style()
style.configure('BW.TLabel', foreground='red')
label = ttk.Label(style='BW.TLabel')
return main, progressbar, label
示例2: Config
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import winfo_reqheight [as 别名]
#.........这里部分代码省略.........
self.ui_dblbl = Label(self.ui_midframe, text="Database name",
justify=LEFT, anchor=W, font=font )
self.ui_dblbl.grid(row=3, column=0, padx=2, pady=2)
self.ui_db = Entry(self.ui_midframe, font=font)
self.ui_db.grid(row=3, column=1, padx=2, pady=2)
# OUT
self.ui_outlbl = Label(self.ui_midframe, text="Audio output (local/hdmi)",
justify=LEFT, anchor=W, font=font )
self.ui_outlbl.grid(row=4, column=0, padx=2, pady=2)
self.ui_out = Entry(self.ui_midframe, font=font)
self.ui_out.grid(row=4, column=1, padx=2, pady=2)
# OPT
self.ui_optlbl = Label(self.ui_midframe, text="Omxplayer extra options",
justify=LEFT, anchor=W, font=font )
self.ui_optlbl.grid(row=5, column=0, padx=2, pady=2)
self.ui_opt = Entry(self.ui_midframe, font=font)
self.ui_opt.grid(row=5, column=1, padx=2, pady=2)
# URL1L
self.ui_url1llbl = Label(self.ui_midframe, text="Url 1 name",
justify=LEFT, anchor=W, font=font )
self.ui_url1llbl.grid(row=6, column=0, padx=2, pady=2)
self.ui_url1l = Entry(self.ui_midframe, font=font)
self.ui_url1l.grid(row=6, column=1, padx=2, pady=2)
# URL1
self.ui_url1lbl = Label(self.ui_midframe, text="Url 1",
justify=LEFT, anchor=W, font=font )
self.ui_url1lbl.grid(row=7, column=0, padx=2, pady=2)
self.ui_url1 = Entry(self.ui_midframe, font=font)
self.ui_url1.grid(row=7, column=1, padx=2, pady=2)
# URL2L
self.ui_url2llbl = Label(self.ui_midframe, text="Url 2 name",
justify=LEFT, anchor=W, font=font )
self.ui_url2llbl.grid(row=8, column=0, padx=2, pady=2)
self.ui_url2l = Entry(self.ui_midframe, font=font)
self.ui_url2l.grid(row=8, column=1, padx=2, pady=2)
# URL2
self.ui_url2lbl = Label(self.ui_midframe, text="Url 2",
justify=LEFT, anchor=W, font=font )
self.ui_url2lbl.grid(row=9, column=0, padx=2, pady=2)
self.ui_url2 = Entry(self.ui_midframe, font=font)
self.ui_url2.grid(row=9, column=1, padx=2, pady=2)
# URL3L
self.ui_url3llbl = Label(self.ui_midframe, text="Url 3 name",
justify=LEFT, anchor=W, font=font )
self.ui_url3llbl.grid(row=10, column=0, padx=2, pady=2)
self.ui_url3l = Entry(self.ui_midframe, font=font)
self.ui_url3l.grid(row=10, column=1, padx=2, pady=2)
# URL3
self.ui_url3lbl = Label(self.ui_midframe, text="Url 3",
justify=LEFT, anchor=W, font=font )
self.ui_url3lbl.grid(row=11, column=0, padx=2, pady=2)
self.ui_url3 = Entry(self.ui_midframe, font=font)
self.ui_url3.grid(row=11, column=1, padx=2, pady=2)
# URL4L
self.ui_url4llbl = Label(self.ui_midframe, text="Url 4 name",
justify=LEFT, anchor=W, font=font )
self.ui_url4llbl.grid(row=12, column=0, padx=2, pady=2)
self.ui_url4l = Entry(self.ui_midframe, font=font)
self.ui_url4l.grid(row=12, column=1, padx=2, pady=2)
# URL4
self.ui_url4lbl = Label(self.ui_midframe, text="Url 4",
justify=LEFT, anchor=W, font=font )
self.ui_url4lbl.grid(row=13, column=0, padx=2, pady=2)
self.ui_url4 = Entry(self.ui_midframe, font=font)
self.ui_url4.grid(row=13, column=1, padx=2, pady=2)
# URL5L
self.ui_url5llbl = Label(self.ui_midframe, text="Url 5 name",
justify=LEFT, anchor=W, font=font )
self.ui_url5llbl.grid(row=14, column=0, padx=2, pady=2)
self.ui_url5l = Entry(self.ui_midframe, font=font)
self.ui_url5l.grid(row=14, column=1, padx=2, pady=2)
# URL5
self.ui_url5lbl = Label(self.ui_midframe, text="Url 5",
justify=LEFT, anchor=W, font=font )
self.ui_url5lbl.grid(row=15, column=0, padx=2, pady=2)
self.ui_url5 = Entry(self.ui_midframe, font=font)
self.ui_url5.grid(row=15, column=1, padx=2, pady=2)
# Bottom Frame (buttons group)
self.ui_botframe = Frame(self.root, borderwidth=2)
self.ui_botframe.pack(anchor='s')
# Button Save
self.ui_butsave = Button(self.ui_botframe, text="Save",
command=self.save, font=font)
self.ui_butsave.grid(row=1, column=0, padx=2, pady=2)
# Button Close
self.ui_butquit = Button(self.ui_botframe, text="Close",
command=self.root.destroy, font=font)
self.ui_butquit.grid(row=1, column=1, padx=2, pady=2)
# Window position
self.root.update_idletasks()
w = self.root.winfo_reqwidth()
h = self.root.winfo_reqheight()
ws = self.root.winfo_screenwidth()
hs = self.root.winfo_screenheight()
x = (ws/2) - (w/2)
y = (hs/2) - (h/2)
self.root.geometry('%dx%d+%d+%d' % (w, h, x, y))
self.root.minsize(w, h)
self.root.maxsize(w, h)
return(True)
示例3: rmap
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import winfo_reqheight [as 别名]
#.........这里部分代码省略.........
exec(self._solve)
def demoAll(self):
"""Показать выполнение всех заданий в автоматическом режиме
Пример использования:
#-------------------
r.demoAll()
#-------------------
Для того, чтобы Робот двигался быстрее, используйте
#-------------------
r.sleep = 0
r.demoAll()
#-------------------
"""
global r
r = self
for x in r.m:
r.lm(x)
print(x)
r.demo()
r.pause()
def __init__(self):
self._w = 4 # толщина стен
self._d = 4 # на столько меньше клетки закраска (с каждой стороны)
self.sleep = 0.5 # замедление
self._font_size = self._size // 2
self._tk = Tk()
self._tk.geometry('+0+0')
x = (self._tk.winfo_screenwidth() - self._tk.winfo_reqwidth()) / 3
y = (self._tk.winfo_screenheight() - self._tk.winfo_reqheight()) / 4
self._tk.wm_geometry("+%d+%d" % (x, y))
self._tk.title('Robot-hobot')
self._canvas = Canvas(self._tk, width=(self._size*(self._nc+1)), height=(self._size*(self._nr+1)), bg="gray")
buttons = Frame(self._tk)
self.task = Label (self._tk, justify = 'left')
self.res = Label (self._tk, justify = 'left')
self._but_start = Button(buttons,text = 'start',width=10,height=1)
self._but_start.bind('<ButtonRelease-1>',self.but1)
self._but_demo = Button(buttons,text = 'demo',width=10,height=1)
self._but_demo.bind('<ButtonRelease-1>',self.but_demo)
self._but_reload = Button(buttons,text = 'reload',width=10,height=1)
self._but_reload.bind('<ButtonRelease-1>',self.but_reload)
self._but_load_next = Button(buttons,text = 'load next',width=10,height=1)
self._but_load_next.bind('<ButtonRelease-1>',self.but_load_next)
buttons.grid(row=0, column=0, sticky = "w")
self._canvas.grid(row=1, column=0, sticky = "e")
self._but_start.pack(side = "left")
self._but_demo.pack(side = "left")
self._but_reload.pack(side = "left")
self._but_load_next.pack(side = "left")
self.task.grid(row=3, column=0, sticky = "w")
self.res.grid(row=4, column=0, sticky = "w")
## self.loadmap()
def but_load_next(self,event):