Answer the question
In order to leave comments, you need to log in
How to make a dictionary global?
I don't know Python well, but I try to learn it.
The fact is that the function does not see the dictionary that I declared outside the function, it is understandable, but how to declare this dictionary global in order to update, call and view it from any function and beyond?
active_list = {}
def on_click(e,h,w):
e.pushButton.setStyleSheet('color: white; background-color: #4460F1; border-radius: 5px; border: 1px solid #4460F1;')
# D1Standart(int(w),int(h))
active_list['DPM1'] = 1
print(active_list)
active_list['DPM1'] = 1
NameError: name 'active_list' is not defined
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question