mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-16 19:50:19 +01:00
be036e72a5
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
74 lines
1.9 KiB
Diff
74 lines
1.9 KiB
Diff
--- Pmw-2.1.1/Pmw/Pmw_2_1_1/doc/example.orig.py 2024-01-16 20:29:10.976574813 +0200
|
|
+++ Pmw-2.1.1/Pmw/Pmw_2_1_1/doc/example.py 2024-01-16 20:31:31.276588327 +0200
|
|
@@ -1,10 +1,10 @@
|
|
-import tkinter
|
|
+import tkinter
|
|
import Pmw
|
|
-
|
|
+
|
|
class ThresholdScale(Pmw.MegaWidget):
|
|
""" Megawidget containing a scale and an indicator.
|
|
"""
|
|
-
|
|
+
|
|
def __init__(self, parent = None, **kw):
|
|
|
|
# Define the megawidget options.
|
|
@@ -14,13 +14,13 @@
|
|
('value', None, Pmw.INITOPT),
|
|
)
|
|
self.defineoptions(kw, optiondefs)
|
|
-
|
|
+
|
|
# Initialise base class (after defining options).
|
|
Pmw.MegaWidget.__init__(self, parent)
|
|
-
|
|
+
|
|
# Create the components.
|
|
interior = self.interior()
|
|
-
|
|
+
|
|
# Create the indicator component.
|
|
self.indicator = self.createcomponent('indicator',
|
|
(), None,
|
|
@@ -30,7 +30,7 @@
|
|
borderwidth = 2,
|
|
relief = 'raised')
|
|
self.indicator.grid()
|
|
-
|
|
+
|
|
# Create the scale component.
|
|
self.scale = self.createcomponent('scale',
|
|
(), None,
|
|
@@ -42,23 +42,23 @@
|
|
to = 0,
|
|
showvalue = 0)
|
|
self.scale.grid()
|
|
-
|
|
+
|
|
value = self['value']
|
|
if value is not None:
|
|
self.scale.set(value)
|
|
-
|
|
+
|
|
# Check keywords and initialise options.
|
|
self.initialiseoptions()
|
|
|
|
def _doCommand(self, valueStr):
|
|
- if self.scale.get() > self['threshold']:
|
|
- color = self['colors'][1]
|
|
- else:
|
|
- color = self['colors'][0]
|
|
- self.indicator.configure(background = color)
|
|
+ if self.scale.get() > self['threshold']:
|
|
+ color = self['colors'][1]
|
|
+ else:
|
|
+ color = self['colors'][0]
|
|
+ self.indicator.configure(background = color)
|
|
|
|
Pmw.forwardmethods(ThresholdScale, tkinter.Scale, 'scale')
|
|
-
|
|
+
|
|
# Initialise tkinter and Pmw.
|
|
root = Pmw.initialise()
|
|
root.title('Pmw ThresholdScale demonstration')
|