Skip to content

Commit

Permalink
Updated example and screenshot.
Browse files Browse the repository at this point in the history
  • Loading branch information
phuel committed Aug 23, 2022
1 parent 52d9775 commit a61c460
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 10 deletions.
43 changes: 34 additions & 9 deletions example.kv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#:kivy 2.0
#:kivy 1.0

<Knob>:
size_hint: None, None
Expand All @@ -10,6 +10,32 @@
<BlackKnob@Knob>:
knobimg_source: "img/knob_black.png"

<DecimalTickKnob>:
size_hint: None, None
size: 150, 150
min: 0
max: 10
value: 0
start_angle: 225
angle_range: 270
knobimg_source: "img/knob_black3.png"
knobimg_size: 0.7
markeroff_color: 0, 0, 0, 1
show_marker: False

<SymmetricTickKnob>:
size_hint: None, None
size: 150, 150
min: -50
max: 50
value: 0
start_angle: 225
angle_range: 270
knobimg_source: "img/knob_black3.png"
knobimg_size: 0.7
markeroff_color: 0, 0, 0, 1
show_marker: False

<RangeTickKnob>:
size_hint: None, None
size: 150, 150
Expand Down Expand Up @@ -122,11 +148,10 @@ GridLayout:
ValueLabel:
text: "%d" % testknob2.value

BoxLayout:
orientation: 'vertical'
size_hint: None, None
size: 150,200
RangeTickKnob:
id: testknob3
ValueLabel:
text: "%d" % testknob3.value
Widget:

DecimalTickKnob:

SymmetricTickKnob:

RangeTickKnob:
31 changes: 31 additions & 0 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,37 @@
else:
from kivy.garde.knob import Knob, KnobWithTicks, Tick

from kivy.config import Config
Config.set('graphics', 'width', '650')
Config.set('graphics', 'height', '900')
Config.set('graphics', 'resizable', False)
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')

class DecimalTickKnob(KnobWithTicks):
def __init__(self, *args, **kwargs):
ticks = []
for i in range(0,11,2):
ticks.append(Tick(value=i))
ticks.append(Tick(value=i, text=str(i), distance=25))
for i in range(1,10,2):
ticks.append(Tick(value=i, size=(3,5)))
super().__init__(ticks, *args, **kwargs)

class SymmetricTickKnob(KnobWithTicks):
def __init__(self, *args, **kwargs):
ticks = [
Tick(value=-50),
Tick(value=-50, text="-50", distance=25),
Tick(value=-25),
Tick(value=-25, text="-25", distance=25),
Tick(value=0),
Tick(value=0, text="0", distance=25),
Tick(value=25),
Tick(value=25, text="25", distance=25),
Tick(value=50),
Tick(value=50, text="50", distance=25),
]
super().__init__(ticks, *args, **kwargs)

class RangeTickKnob(KnobWithTicks):
def __init__(self, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion knob.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"""

__all__ = ('Knob',)
__version__ = '0.2'
__version__ = '0.3'

import math

Expand Down
Binary file modified screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a61c460

Please sign in to comment.