-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest2.py
More file actions
40 lines (29 loc) · 1005 Bytes
/
test2.py
File metadata and controls
40 lines (29 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from Tkinter import *
from PIL import ImageTk
from PIL import Image
class Fullscreen_Window(object):
def __init__(self):
self.tk = Tk()
image = Image.open("/home/blake/Desktop/2014-11-13.jpg")
photo = ImageTk.PhotoImage(image)
self.tk.attributes('-zoomed', True) # This just maximizes it so we can see the window. It's nothing to do with fullscreen.
self.tk.configure(bg='black')
self.frame = Frame(self.tk)
self.state = False
self.tk.bind("<F11>", self.toggle_fullscreen)
self.tk.bind("<Escape>", self.end_fullscreen)
w = Label(self.tk, image=photo, background='black',)
w.pack()
self.tk.mainloop()
def toggle_fullscreen(self, event=None):
self.state = not self.state # Just toggling the boolean
self.tk.attributes("-fullscreen", self.state)
return "break"
def end_fullscreen(self, event=None):
self.state = False
self.tk.attributes("-fullscreen", False)
return "break"
def show_image(self):
pass
if __name__ == '__main__':
w = Fullscreen_Window()