Quellcode gekürzt.
This commit is contained in:
parent
8e7a1cbf76
commit
490f7d703f
@ -1,12 +1,10 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
from tkinter import ttk
|
from tkinter import ttk
|
||||||
|
|
||||||
# --------------------------
|
# --------------------------
|
||||||
# Model
|
# Model
|
||||||
# --------------------------
|
# --------------------------
|
||||||
|
|
||||||
class TLight:
|
class TLight:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.colors = {0: "red", 1: "yellow", 2: "green", 3: "yellow"}
|
self.colors = {0: "red", 1: "yellow", 2: "green", 3: "yellow"}
|
||||||
@ -27,7 +25,6 @@ class TLight:
|
|||||||
# --------------------------
|
# --------------------------
|
||||||
# Controller
|
# Controller
|
||||||
# --------------------------
|
# --------------------------
|
||||||
|
|
||||||
class TLightController:
|
class TLightController:
|
||||||
def __init__(self, app):
|
def __init__(self, app):
|
||||||
self.app = app
|
self.app = app
|
||||||
@ -40,12 +37,10 @@ class TLightController:
|
|||||||
def update_view(self):
|
def update_view(self):
|
||||||
color = self.tlight.get_color()
|
color = self.tlight.get_color()
|
||||||
self.app.change_light_display(color)
|
self.app.change_light_display(color)
|
||||||
|
|
||||||
|
|
||||||
# --------------------------
|
# --------------------------
|
||||||
# View / Main Application
|
# View / Main Application
|
||||||
# --------------------------
|
# --------------------------
|
||||||
|
|
||||||
class TLightApp(Tk):
|
class TLightApp(Tk):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@ -63,7 +58,7 @@ class TLightApp(Tk):
|
|||||||
|
|
||||||
button_switch = ttk.Button(mainframe, text="Schalte um", command=self.controller.change_light)
|
button_switch = ttk.Button(mainframe, text="Schalte um", command=self.controller.change_light)
|
||||||
button_switch.grid(column=0, row=0, sticky=W)
|
button_switch.grid(column=0, row=0, sticky=W)
|
||||||
light_canvas = Canvas(mainframe, width=50, height=50, background="black")
|
light_canvas = Canvas(mainframe, width=50, height=50, background="black")
|
||||||
light_canvas.grid(column=1, row=0, sticky=W)
|
light_canvas.grid(column=1, row=0, sticky=W)
|
||||||
self.lc = light_canvas
|
self.lc = light_canvas
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user