-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfullscreen.py
96 lines (70 loc) · 2.46 KB
/
fullscreen.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env python3
import tkinter as tk
import os
from oscola import OscOla
# https://stackoverflow.com/questions/26286660/how-to-make-a-window-fullscreen-in-a-secondary-display-with-tkinter
# https://stackoverflow.com/questions/7966119/display-fullscreen-mode-on-tkinter
class Gui:
fullscreen = False
def __init__(self, action = None):
self.root = tk.Tk()
self.root.bind("<F11>", self.toggleFullScreen)
self.root.bind("f", self.toggleFullScreen)
self.root.bind("<Alt-Return>", self.toggleFullScreen)
self.root.bind("<Control-w>", self.quit)
self.root.bind ("q", self.quit)
self.root.geometry("640x360+30+30")
self.fx_func = None
def toggleFullScreen(self, event):
if self.fullscreen:
self.deactivateFullscreen()
else:
self.activateFullscreen()
def activateFullscreen(self):
self.fullscreen = True
if os.name == "posix":
self.root.attributes ("-fullscreen", True)
self.root.update()
else:
self.root.state("zoomed")
self.root.overrideredirect(True)
self.root.config (cursor="none")
def deactivateFullscreen(self):
self.fullscreen = False
if os.name == "posix":
self.root.geometry("170x200+30+30")
self.root.attributes ("-fullscreen", False)
else:
self.root.state("normal")
self.root.geometry("640x360+30+30")
self.root.overrideredirect(False)
self.root.config (cursor="")
def quit(self, event=None):
print("quiting...", event)
self.root.quit()
def background (self, red, green, blue):
""" Background-Farbe festlegen """
backcol = f"#{red:02x}{green:02x}{blue:02x}"
self.root['background'] = backcol
def set_fx (self, newfunc):
""" FX Funkion zuweisen """
self.fx_func = newfunc
def run_fx (self):
""" FX in mainloop ausführen """
self.fx_func ()
self.root.after (10, self.run_fx)
# -----------------------------------------------------------------------
if __name__ == '__main__':
w = Gui()
oscola = OscOla ()
def colorchanger ():
# Hintergrundfarbe ändern
rgb = oscola.get_channels (1,3)
w.background (rgb[0], rgb[1], rgb[2])
w.set_fx (colorchanger)
w.run_fx ()
try:
w.root.mainloop()
except:
oscola.shutdown ()
w.quit ()