summaryrefslogtreecommitdiffstats
path: root/superkaramba/examples/change_interval
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2022-11-11 17:41:30 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2022-11-13 12:09:49 +0900
commitda9cd0c056c8275033fca84a1c8d49a8edb0c8ee (patch)
tree2521f74c0b2868d82518e13053fb01cc179e9a23 /superkaramba/examples/change_interval
parent5dab6232ef3b3715630cf88eb40c4c6021e65f07 (diff)
downloadtdeutils-da9cd0c056c8275033fca84a1c8d49a8edb0c8ee.tar.gz
tdeutils-da9cd0c056c8275033fca84a1c8d49a8edb0c8ee.zip
superkaramba: convert examples to python3.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'superkaramba/examples/change_interval')
-rw-r--r--superkaramba/examples/change_interval/interval.py53
1 files changed, 28 insertions, 25 deletions
diff --git a/superkaramba/examples/change_interval/interval.py b/superkaramba/examples/change_interval/interval.py
index 6c3422a..6a72434 100644
--- a/superkaramba/examples/change_interval/interval.py
+++ b/superkaramba/examples/change_interval/interval.py
@@ -11,50 +11,53 @@ text = None
#this is called when you widget is initialized
def initWidget(widget):
-
- karamba.redrawWidget(widget)
+ global seq
+ global text
+ seq = 0
+ text = None
+ karamba.redrawWidget(widget)
# sequence drops down to zero and changes the time interval to 1 second.
# keeps counting down thereafter...
def widgetUpdated(widget):
- global seq
- global text
+ global seq
+ global text
- seq -= 1
+ seq -= 1
- if seq <= 0:
- karamba.changeInterval(widget, 1000)
+ if seq <= 0:
+ karamba.changeInterval(widget, 1000)
- if seq <= 0:
- message = "biding-time seq:%d" % -seq
- else:
- message = "wiggle seq:%d" % seq
+ if seq <= 0:
+ message = "biding-time seq:%d" % -seq
+ else:
+ message = "wiggle seq:%d" % seq
- # delete previous text if exists.
- if text is not None:
- karamba.deleteText(widget, text)
+ # delete previous text if exists.
+ if text is not None:
+ karamba.deleteText(widget, text)
- # display new message
- text = karamba.createText(widget, 0, 20, 300, 20, message)
- karamba.changeTextColor(widget, text, 252,252,252)
+ # display new message
+ text = karamba.createText(widget, 0, 20, 300, 20, message)
+ karamba.changeTextColor(widget, text, 252,252,252)
- karamba.redrawWidget(widget)
+ karamba.redrawWidget(widget)
# wiggle the mouse over the widget to get the sequence number increased more.
# also set the refresh rate to 50ms so that the theme has to fight against
# the wiggling.
def widgetMouseMoved(widget, x, y, button):
- global seq
+ global seq
- if seq <= 0:
- seq = 0
- karamba.changeInterval(widget, 50)
+ if seq <= 0:
+ seq = 0
+ karamba.changeInterval(widget, 50)
- seq += 1
-
+ seq += 1
+
# This will be printed when the widget loads.
-print "Loaded my python extension!"
+print("Loaded my python extension!")