-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from naejgz/master
Adding Gauge2
- Loading branch information
Showing
7 changed files
with
276 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[Dolphin] | ||
SortRole=modificationtime | ||
Timestamp=2018,6,9,11,51,23 | ||
Version=4 | ||
ViewMode=1 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import tkinter as tk | ||
import tk_tools | ||
|
||
|
||
root = tk.Tk() | ||
|
||
max_speed = 20000 | ||
|
||
speed_gauge = tk_tools.Gauge2(root, | ||
max_value=max_speed, | ||
label='speed', unit=' m/h',bg='grey') | ||
speed_gauge.grid(row=0, column=0, sticky='news') | ||
|
||
|
||
tach_gauge = tk_tools.Gauge2(root, | ||
max_value=8000, | ||
label='tach', unit=' RPM', | ||
divisions=10) | ||
tach_gauge.grid(row=1, column=0, sticky='news') | ||
|
||
strange_gauge = tk_tools.Gauge2(root, | ||
max_value=30000, | ||
label='strange', unit=' blah', | ||
divisions=10, red=90, yellow=60) | ||
strange_gauge.grid(row=2, column=0, sticky='news') | ||
|
||
batV_gauge = tk_tools.Gauge2(root, height=120, width=250, | ||
max_value=16, min_value=8, | ||
label='Bat voltage', unit='V', | ||
divisions=8, yellow=60, red=75, | ||
red_low=30, yellow_low=40) | ||
batV_gauge.grid(row=0, column=1, sticky='news') | ||
|
||
batI_gauge = tk_tools.Gauge2(root, height=120, width=250, | ||
max_value=6, min_value=-8, | ||
label='Bat current', unit='A', | ||
divisions=14, yellow=80, red=90, | ||
red_low=20, yellow_low=30,bg='lavender') | ||
batI_gauge.grid(row=1, column=1, sticky='news') | ||
|
||
count = 0 | ||
up = True | ||
|
||
|
||
def update_gauge(): | ||
global count, up | ||
|
||
increment = 30 | ||
|
||
if up: | ||
count += increment | ||
if count > max_speed: | ||
up = False | ||
else: | ||
count -= increment | ||
|
||
if count <= 0.0: | ||
up = True | ||
|
||
speed_gauge.set_value(count) | ||
tach_gauge.set_value(count) | ||
strange_gauge.set_value(count) | ||
batV_gauge.set_value(count/1000) | ||
batI_gauge.set_value((count-10000)/1000) | ||
|
||
root.after(50, update_gauge) | ||
|
||
|
||
root.after(100, update_gauge) | ||
|
||
root.mainloop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
from tk_tools.canvas import RotaryScale, Gauge, Graph, Led | ||
from tk_tools.groups import EntryGrid, LabelGrid, \ | ||
KeyValueEntry, SpreadSheetReader, ButtonGrid, \ | ||
Calendar, MultiSlotFrame, SevenSegment, SevenSegmentDigits | ||
from tk_tools.widgets import SmartOptionMenu, SmartSpinBox, \ | ||
SmartCheckbutton, BinaryLabel, ByteLabel | ||
from tk_tools.tooltips import ToolTip | ||
|
||
from tk_tools.version import __version__ | ||
|
||
|
||
__all__ = [ | ||
'RotaryScale', 'Gauge', 'Graph', 'Led', | ||
'EntryGrid', 'LabelGrid', 'ButtonGrid', 'KeyValueEntry', | ||
'SpreadSheetReader', 'SmartOptionMenu', 'SmartSpinBox', | ||
'SmartCheckbutton', 'Calendar', 'MultiSlotFrame', | ||
'SevenSegment', 'SevenSegmentDigits', | ||
'BinaryLabel', 'ByteLabel', 'ToolTip', | ||
'__version__' | ||
] | ||
from tk_tools.canvas import RotaryScale, Gauge, Graph, Led, Gauge2 | ||
from tk_tools.groups import EntryGrid, LabelGrid, \ | ||
KeyValueEntry, SpreadSheetReader, ButtonGrid, \ | ||
Calendar, MultiSlotFrame, SevenSegment, SevenSegmentDigits | ||
from tk_tools.widgets import SmartOptionMenu, SmartSpinBox, \ | ||
SmartCheckbutton, BinaryLabel, ByteLabel | ||
from tk_tools.tooltips import ToolTip | ||
|
||
from tk_tools.version import __version__ | ||
|
||
|
||
__all__ = [ | ||
'RotaryScale', 'Gauge', 'Graph', 'Led', 'Gauge2', | ||
'EntryGrid', 'LabelGrid', 'ButtonGrid', 'KeyValueEntry', | ||
'SpreadSheetReader', 'SmartOptionMenu', 'SmartSpinBox', | ||
'SmartCheckbutton', 'Calendar', 'MultiSlotFrame', | ||
'SevenSegment', 'SevenSegmentDigits', | ||
'BinaryLabel', 'ByteLabel', 'ToolTip', | ||
'__version__' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters