python - Accessing variable from class in different module -
trying create separate module function saves qlineedit widgets text text file, having issues trying access modules variables inside class , function.
module i'm creating:
import vls vs = vls.ui_vls().setupui() class saveinput: def savetext (self): savedtext = open('saved_input.txt', 'w') savedtext.write('stag#' + '-' + vs.stag.text() + '\n')
imported module:
class ui_vls(object): def setupui(self, vls): vls.setobjectname("value") self.scrollareawidgetcontents = qtwidgets.qwidget() self.scrollareawidgetcontents.setgeometry(qtcore.qrect(0, 0, 1006, 1283)) self.scrollareawidgetcontents.setobjectname("scrollarea") self.gridlayout_2 = qtwidgets.qgridlayout(self.scrollareawidgetcontents) self.gridlayout_2.setcontentsmargins(0, 0, 0, 0) self.gridlayout_2.setobjectname("gridlayout_2") self.stag = qtwidgets.qlineedit(self.scrollareawidgetcontents) sizepolicy = qtwidgets.qsizepolicy(qtwidgets.qsizepolicy.fixed, qtwidgets.qsizepolicy.fixed) sizepolicy.sethorizontalstretch(0) sizepolicy.setverticalstretch(0) self.stag.setsizepolicy(sizepolicy) self.stag.setmaximumsize(qtcore.qsize(50, 16777215)) self.stag.setobjectname("stag") self.gridlayout_2.addwidget(self.stag, 1, 4, 1, 1)
error (1):
typeerror: setupui() missing 1 required positional argument: 'vls'
i understand error 2nd line in first block of code,that doesn't have .setupui(vls). however, when gives me error because i'm referring module itself.
attributeerror: module 'vls' has no attribute 'setobjectname'
is there way of accessing variables or have butchered code?
Comments
Post a Comment