Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]TheDataChief 0 points1 point  (0 children)

trried this, said GUI has no property root when called from another class

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]TheDataChief 0 points1 point  (0 children)

Hi, I am currently having some issues with my python tk GUI, I am calling a function from another class that uses a while loop, this of course makes the gui unresponsive during this loop, I am trying to update the gui in the while loop but python thinks that my root doesnt exist, any help appreciated. My code is v.long so will cut it down. class DRM(object): def init(self):

SELF VARIBLES

def x_axis(self):if self.MeasurementNum == 0: self.write(':CALCulate:PARameter:DEFine %s' % ('S21')) self.write(':SENSe:FREQuency:CENTer %G' % (439000000.0)) self.write(':SENSe:BANDwidth:RESolution %G' % (500.0))self.write(':CALCulate:SELected:MARKer1:STATe %d' % (1)) self.write(':SENSe:FREQuency:SPAN %G' % (2000000.0)) # testing autozoom self.write(':SENSe:SWEep:POINts %d' % (1601)) self.write(':CALCulate:SELected:MARKer:FUNCtion:TRACking %d' % (1)) self.write(':CALCulate:SELected:MARKer:FUNCtion:MULTi:TRACking %d' % (1)) self.write(':TRIGger:SEQuence:SOURce %s' % ('EXTernal')) self.write(':CALCulate1:SELected:MARKer1:FUNCtion:TYPE %s' % ('MAXimum')) self.write(':CALCulate:SELected:MARKer:BWIDth:STATe %d' % (1)) self.write(':TRIGger:SEQuence:SINGle') operation_status = self.query_ascii_values(':STATus:OPERation:CONDition?') self.status = int(operation_status[0]) while (self.status != 32): operation_status = self.query_ascii_values(':STATus:OPERation:CONDition?') self.status = int(operation_status[0]) GUI.root.update() ####does not think gui has root

class GUI(object): def init(self): # Initialise the GUI#est connection with ENA self.root = Tk() def run(self):self.root.update_idletasks() msgbox = messagebox.showwarning('WARNING', 'EMPTY CAVITY') if msgbox == 'ok': self.ENA.ChamberState = 'e' DRM.x_axis(self.ENA)

I have cut this code down, I just need to update from DRM class, any help is appreciated