python - Using the self.variable system in a custom module -


i have been writing code controlled assessment (this isn't that's required before think i'm cheating... got that's stuff sorted months ago :-p) , have started insert of functions modules. had things such generating number using , replicating many times saw no reason make module.

anyway, i'm trying load "save" module , run code within (also called "save") issue requires "self.[variable]" style variable (it's listbox used tkinter if wondering) , not allow me send information when request run. it's being triggered button , when button pressed supposed run modules code , send module number , listbox's contents within variable. ideas how can this?

code button:

self.filemenu.add_command(label="save", command=save.save(self, mainfile)) 

code module (the majority of anyway):

def save(self, mainfile):     = 0     open(mainfile, "w") savefile:         savefile.write("\n".join(self.listbox.get(0,end))) 

(that bit of code doesn't seem being posted in right format sorry :3) appreciated...i luckily don't need think day or 2 , if comes have weekend...but have till week december done... :3


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -