summaryrefslogtreecommitdiff
path: root/tk.py
diff options
context:
space:
mode:
authorBen Connors <benconnors@outlook.com>2019-01-22 15:36:34 -0500
committerBen Connors <benconnors@outlook.com>2019-01-22 15:36:34 -0500
commitca498eba3d9eaa2c25e281f9f8e6b5c3c8646ba6 (patch)
tree3a39e50e4e605bb2f55a4f9a606a9f0b6003f7f6 /tk.py
Initial commit
- Finish and test workspace.Show rendering - Add some basic image visualization - Add some utility classes (audio, Tk)
Diffstat (limited to 'tk.py')
-rwxr-xr-xtk.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tk.py b/tk.py
new file mode 100755
index 0000000..e9ba669
--- /dev/null
+++ b/tk.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+
+"""Module containing Tk widgets for BLC."""
+
+from tkinter import Frame, N, E, S, W, VERTICAL
+from tkinter.ttk import Label, Scale
+
+class DMXView(Frame):
+ """Class for viewing DMX values."""
+ def update_vals(self, vals:tuple):
+ """Update the current values.
+
+ Parameters:
+ vals: a tuple of (channel, value) pairs. values must be integers from 0 to 255,
+ inclusive.
+ """
+ for c,v in vals:
+ self.channels[c-1-self.offset].set(255-v)
+
+ def __init__(self, master, count=36, offset=0):
+ super().__init__(master)
+
+ self.channels = []
+ self.offset = 0
+ self.rowconfigure(0,weight=1)
+ for c in range(count):
+ self.columnconfigure(c,weight=1)
+ s = Scale(self, from_=0, to=255, orient=VERTICAL, length=300)
+ s.grid(row=0, column=c, sticky=N+E+S+W)
+ s.set(255)
+ Label(self, text=str(c+1+offset)).grid(row=1, column=c,sticky=N+E+S+W)
+ self.channels.append(s)