knobs module takes an attribute 'values'

This commit is contained in:
SallarShayegan
2025-02-28 13:33:11 +01:00
parent 06006194a8
commit 3eae3a7cf6
3 changed files with 8 additions and 6 deletions

View File

@ -5,7 +5,7 @@ from knob import *
class Knobs:
def __init__(self, gui):
def __init__(self, gui, values):
self.gui = gui
@ -20,6 +20,8 @@ class Knobs:
'Gain'
]
self.values = values
# Create and position the knobs
self.knobs_radius = self.gui.screenW / 25
knobs_spacing = self.knobs_radius * 2
@ -29,7 +31,7 @@ class Knobs:
y = knobs_y
self.knobs = []
for i in range(8):
self.knobs.append(Knob(self, knob_names[i], self.knobs_radius, (x, y)))
self.knobs.append(Knob(self, knob_names[i], self.knobs_radius, (x, y), values[i]))
y += self.knobs_radius + knobs_spacing
if i == 3 or i == 6:
x += self.knobs_radius + knobs_spacing
@ -37,7 +39,7 @@ class Knobs:
def display_label(self, knob):
label_fx_name = font_helvetica.render(knob.name, False, color_primary_light)
label_fx_value = font_helvetica.render('[ ' + str(knob.value) + '% ]',
label_fx_value = font_helvetica.render('[ ' + str(knob.value*100) + '% ]',
False, color_primary_light)
label_x = self.gui.screenW - label_fx_name.get_width() - 20