question on Classes and closing windows
#1
i have multiple classes in my latest py. i pass data from one class to another, create a control and open a window.

i want to exit that window (close it) and then go back to the previous one. having issues... it crashes on me.

here's my code for my 2nd class (main_screen is class that sends data to imagewin)...

class imagewin(xbmcgui.window):
def (self,img_screen):
if emulating: xbmcgui.window.(self)
res = self.getresolution()
self.scalex = ( float(self.getwidth()) / float(720) )
self.scaley = ( float(self.getheight()) / float(480) )
self.setcoordinateresolution(res)
self.img = self.addcontrol(xbmcgui.controlimage(0,0,720,480, img_screen))

def onaction(self, action):
if action == action_previous_menu or action == action_parent_dir:
self.removecontrol(self.img)
self.main_screen()


thanks!
I'm not an expert but I play one at work.
Reply
#2
you don't want to use the getresolution() function as a variable for the setcoordinateresolution() function. just self.setcoordinateresolution(the resolution your developing in). then you shouldn't need the scalex and scaley.

as for having two window classes, look at launchbrowser. it uses a second window class for the autocomplete. that should give you an idea how to call and close out a window. it looks like you trying to call a window class then call the class that called it. that doesn't sound right.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#3
still having the issue.

the new window (including single control created) shows fine, but when exiting, the py crashes completely... with some ambiguous memory error.

code to show what i'm doing (greatly condensed)...


class displayadjust(xbmcgui.window):
def oncontrol(self, control):
d = imagewin(img_screen)
d.show()

class imagewin(xbmcgui.window):
def (self,img_screen):
if emulating: xbmcgui.window.(self)
res = self.getresolution()
self.setcoordinateresolution(res)
self.addcontrol(xbmcgui.controlimage(0,0,720,480, img_screen))

def onaction(self, action):
if action == action_previous_menu or action == action_parent_dir:
self.close()
I'm not an expert but I play one at work.
Reply
#4
try domodel rather than show
read the xbmc online-manual, faq and search the forums before posting! do not e-mail the xbmc-team asking for support!
read/follow the forum rules! note! team-xbmc never have and never will host or distribute ms-xdk binaries/executables!
Reply
#5
that works... thanks!
I'm not an expert but I play one at work.
Reply

Logout Mark Read Team Forum Stats Members Help
question on Classes and closing windows0