Share global variable to another script python -
i have 2 scripts :
1.py
activation_splitview = 0 class monprog(frame): def __init__(self, master=none): blablabla def splitdisplay(self): blablabla
i want modify variable activation_splitview
1 when use splitdisplay
function. second script 2.py can read activation_splitdisplay
of import 1 , code. read variable when he's launch, dont have make pipe/multiprocessing , variable not use anymore.
if 1.activation_splitview == 0: tkmessagebox.showwarning('0') else: tkmessagebox.showwarning('1')
but read 0 variable, don't know how modify , send new value second script.
can me please?
loris
i think following code should use, when use class , return var:
1.py:
activation_splitview = 21 class monprog(object): def __init__(self, master=none): # balabala def splitdisplay(self): global activation_splitview # use activation_splitview here. # should save `activation_splitview` 1 file, eg: test.ini
2.py
# in 2.py file. # read test.ini file in order `activation_splitview`.
Comments
Post a Comment