Python function doesn't work

12/31/2014 22:58 Noa_#1
in my case "__CreateSubFunction" not work, so maybe i got a error think in this function, but i dont know.
PHP Code:
def __init__(self):
        
ui.Window.__init__(self)
        
self.Board ui.BoardWithTitleBar()
        
self.Board.SetSize(300500)
        
self.Board.SetCenterPosition()
        
self.Board.AddFlag('movable')
        
self.Board.AddFlag('float')
        
self.Board.SetTitleName("Test")
        
self.Board.SetCloseEvent(self.Close)
        
self.Board.Show()
        
        
self.mainbutton self.__SetButton(self.Board,50,100,"Base")
        
self.mainbutton.Show()
        
self.mainbutton.SetEvent(self.__CreateSubFunction)
    
def __CreateSubFunction(self):
        
res self.__SetButton(self.mainbutton,10,10,"1")
        
res.Show()
        return 
res

    def __SetButton
(self,parent,x,y,text):
        
button ui.Button()
        
button.SetParent(parent)
        
button.SetPosition(x,y)
        
button.SetUpVisual('d:/ymir work/ui/public/big_button_01.sub')
        
button.SetOverVisual('d:/ymir work/ui/public/big_button_02.sub')
        
button.SetDownVisual('d:/ymir work/ui/public/big_button_03.sub')
        
button.SetText(text)
        return 
button 
cuz this func?

PHP Code:
 def __SetButton(self,parent,x,y,text):
        
button ui.Button()
        
button.SetParent(parent)
        
button.SetPosition(x,y)
        
button.SetUpVisual('d:/ymir work/ui/public/big_button_01.sub')
        
button.SetOverVisual('d:/ymir work/ui/public/big_button_02.sub')
        
button.SetDownVisual('d:/ymir work/ui/public/big_button_03.sub')
        
button.SetText(text)
        return 
button 
there a use button variable and twice is not allowed, maybe use it in list or dic

iam solved it, just button to self.button