Calling function from outside
#1
cut things short his the basics of what im doing
Quote:class mainmenu(xbmcgui.window):
# with stuff here and claling the option window
class options(xbmcgui.window):
def printmy(self, txt):
print txt
#draw to window
return

def something (incoming):
#need to call the printmy in option class.

win = mainmenu()
win.domodal()
del win

where it says #need to call the printmy in option class.

i need to be able to call the printmy function in the option class. so i can pass data through.

at the time the somthing function is called the option class is active and visble and running.

any help would be greatly appreicated. thanks in advance
#2
the way you wrote it, def somthing isn't in another class. i assume it is though, and that that is what you intended.
one way of doing it:

Quote:class options(xbmcgui.window):
  def printmy(self, txt):
     print txt
     #draw to window
     return
class outside:
  def something (incoming):
      #need to call the printmy in option class.
      self.options = options()
      self.options.printmy("whatever you want to print")

if you didn't mean to put def something in another class, you can simply call it with self.printmy().

there might be wrongs in this explainatin as i am tired, but i hope it helped a bit.

you posted in the wrong forum by the way...
xbmcscripts.com administrator

Logout Mark Read Team Forum Stats Members Help
Calling function from outside0