…I could pack everything into a class like so:
class MyApplication:
def __init__(self):
self.my_list = []
def create_list(self, event):
self.my_list = [1, 2, 3, 4, 5]
print(self.my_list)
def modify_list(self, event):
self.my_list.append(6)
print(self.my_list)
and then call the class methods from on_click()
… is this the best way to go?
Edit: It does seem that “throwing everything into a single class” is a popular solution:
- Interactive Elements, general advice needed - #8 by xavArtley
- Using @param.depends in a parameterized Class - #8 by sunny
- Update/manipulate dataframe on button click - #3 by Lewisc2
- How to access object returned by a paramMethod? - #3 by philippjfr
What is not quite clear to me is the point in making all objects in the class param
s instead of instance variables?