本文整理汇总了Python中Tkinter.Tk.winfo_height方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.winfo_height方法的具体用法?Python Tk.winfo_height怎么用?Python Tk.winfo_height使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter.Tk
的用法示例。
在下文中一共展示了Tk.winfo_height方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: expired
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import winfo_height [as 别名]
def expired(cur_dir, amount):
"""
Displays a "deadline expired" picture
"""
root = Tk()
root.focus_set()
# Get the size of the screen and place the splash screen in the center
img = Image.open(str(cur_dir) + '/Images/Expired.gif')
width = img.size[0]
height = img.size[1]
flog = root.winfo_screenwidth()/2-width/2
blog = root.winfo_screenheight()/2-height/2
root.overrideredirect(True)
root.geometry('%dx%d+%d+%d' % (width*1, height + 44, flog, blog))
# Pack a canvas into the top level window.
# This will be used to place the image
expired_canvas = Canvas(root)
expired_canvas.pack(fill="both", expand=True)
# Open the image
imgtk = PhotoImage(img)
# Get the top level window size
# Need a call to update first, or else size is wrong
root.update()
cwidth = root.winfo_width()
cheight = root.winfo_height()
# create the image on the canvas
expired_canvas.create_image(cwidth/2, cheight/2.1, image=imgtk)
Button(root, text='Deadline Expired by ' + str(amount
) + '. Assignment Submitted, time '\
'noted', width=80, height=2, command=root.destroy).pack()
root.after(5000, root.destroy)
root.mainloop()
示例2: failure
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import winfo_height [as 别名]
def failure(reason, cur_dir):
"""
Displays a "submission failure" picture and emails
a bug report to maintenance.
"""
bugmail = {"email": "[email protected]"}
send_email(bugmail, "QR Code Submission Failure", reason, None)
root = Tk()
root.focus_set()
# Get the size of the screen and place the splash screen in the center
gif = Image.open(str(cur_dir) + '/Images/Failure.gif')
width = gif.size[0]
height = gif.size[1]
flog = (root.winfo_screenwidth()/2-width/2)
blog = (root.winfo_screenheight()/2-height/2)
root.overrideredirect(1)
root.geometry('%dx%d+%d+%d' % (width*1, height + 44, flog, blog))
# Pack a canvas into the top level window.
# This will be used to place the image
failure_canvas = Canvas(root)
failure_canvas.pack(fill = "both", expand = True)
# Open the image
imgtk = PhotoImage(gif)
# Get the top level window size
# Need a call to update first, or else size is wrong
root.update()
cwidth = root.winfo_width()
cheight = root.winfo_height()
# create the image on the canvas
failure_canvas.create_image(cwidth/2, cheight/2.24, image=imgtk)
Button(root, text = str(
reason), width = 50, height = 2, command = root.destroy).pack()
root.after(5000, root.destroy)
root.mainloop()
示例3: success
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import winfo_height [as 别名]
def success(cur_dir):
"""
Displays a "successful submission" picture
"""
root = Tk()
root.focus_set()
# Get the size of the screen and place the splash screen in the center
img = Image.open(str(cur_dir) + '/Images/Success.gif')
width = img.size[0]
height = img.size[1]
flog = (root.winfo_screenwidth()/2-width/2)
blog = (root.winfo_screenheight()/2-height/2)
root.overrideredirect(1)
root.geometry('%dx%d+%d+%d' % (width, height, flog, blog))
# Pack a canvas into the top level window.
# This will be used to place the image
success_canvas = Canvas(root)
success_canvas.pack(fill = "both", expand = True)
# Open the image
imgtk = PhotoImage(img)
# Get the top level window size
# Need a call to update first, or else size is wrong
root.update()
cwidth = root.winfo_width()
cheight = root.winfo_height()
# create the image on the canvas
success_canvas.create_image(cwidth/2, cheight/2, image = imgtk)
root.after(4000, root.destroy)
root.mainloop()
示例4: main
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import winfo_height [as 别名]
def main():
root = Tk()
root.geometry('800x600')
root.title('Inventory Manager')
root.update()
root.minsize(root.winfo_width(), root.winfo_height())
root.maxsize(root.winfo_width(), root.winfo_height())
App(root).pack(fill='both', side='top', expand=True)
root.mainloop()
示例5: intro
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import winfo_height [as 别名]
class intro(object):
def __init__(self):
self.master=Tk()
self.x = (self.master.winfo_screenwidth()/3) - (self.master.winfo_width())
self.y = (self.master.winfo_screenheight()/3) - (self.master.winfo_height())
self.master.geometry("+%d+%d" % (self.x, self.y))
self.master.overrideredirect(True)
self.master.resizable(False,False)
self.logointroimg=Image.open(r'img/Logo-introscreenmin.jpg')
self.Tkimage3= ImageTk.PhotoImage(self.logointroimg)
self.canvas = Canvas(self.master, height=378,width=672 )
self.canvas.create_image(336,186, image=self.Tkimage3)
self.canvas.pack()
self.master.after(1250,self.master.destroy)
self.master.mainloop()