Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_scalable.py
- from tkinter import *
- import tkinter.font as tkFont
- root = Tk()
- root.title("Tk_scalable")
- def exitclick():
- root.destroy()
- class FullScreenApp(object):
- def __init__(self, master, **kwargs):
- self.master = master
- pad = 100
- self._geom = '600x400+0+0'
- master.geometry("{0}x{1}+0+0".format(
- master.winfo_screenwidth() - pad, master.winfo_screenheight() - pad))
- master.bind('<Escape>', self.toggle_geom)
- def toggle_geom(self, event):
- geom = self.master.winfo_geometry()
- print(geom, self._geom)
- self.master.geometry(self._geom)
- self._geom = geom
- 0
- frame = Frame(root)
- frame.pack()
- fontStyle = tkFont.Font(family="Lucida Grande", size=40)
- text_intro = "Press Escape !!!"
- label = Label(root, text=text_intro, font=fontStyle)
- label.place(relx=.5, rely=.5, anchor="center")
- fontdefault = tkFont.Font(family="Lucida Grande", size=20)
- close_button = Button(root, text="Close", command=exitclick, height=2, width=8, font=fontdefault)
- close_button.place(relx=0.5, rely=0.8, anchor="center")
- app = FullScreenApp(root)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement