Kafa 153 Posted March 22, 2020 Share Posted March 22, 2020 Hey guys, im trying to do my own System instead of using public stuff (:D) i have a problem with setevent on a button, if i do this: i get a error like this: LuckyBoxWindow.LoadDialog.BindObject - <type 'exceptions.AttributeError'>:'Button' object has no attribute 'im_func' def __Window(self): try: LoadPython = ui.PythonScriptLoader() LoadPython.LoadScriptFile(self, "UIScript/luckyboxwindow.py") except: import exception exception.Abort("LuckyBoxWindow.__LoadScript.LoadObject") try: GetObject = self.GetChild self.board = GetObject("board") self.titleBar = GetObject("LuckyBox_TitleBar") self.LuckyBox_Reward = GetObject("LuckyBox_Reward") #Zielitem Slot self.LuckyBox_Name = GetObject("LuckyBox_Name") #Ergänzung Slot self.RewardItemSlot = GetObject("RewardItemSlot") #Bonus hinzufügen Slot self.RetryButton = GetObject("RetryButton") # Fragezeichen - Systemerklärung self.RecvButton = GetObject("RecvButton") #Succestext self.Notice_Yang = self.GetChild("Notice_Yang") self.RecycleTitleName = self.GetChild("RecycleTitleName") self.NeedMoneySlot = self.GetChild("NeedMoneySlot") self.NeedMoney = self.GetChild("NeedMoney") except: import exception exception.Abort("LuckyBoxWindow.LoadDialog.BindObject") self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close)) self.NeedMoney.Hide() self.RewardItemSlot.SetOverInItemEvent(ui.__mem_func__(self.__OnOverInItem)) self.RewardItemSlot.SetOverOutItemEvent(ui.__mem_func__(self.__OnOverOutItem)) self.RetryButton.SetEvent(ui.__mem_func__(self.RetryButton)) self.RecvButton.SetEvent(ui.__mem_func__(self.RecvButton)) self.pos = int(pos) self.dwBoxVnum = int(itemVnum) self.current_trys = int(trys) self.start_gold = int(start_gold) self.reward_vnum = int(reward_vnum) self.tooltipItem = uiToolTip.ItemToolTip() self.tooltipItem.Hide() @VegaS™ @Nirray @xP3NG3Rx @Gurgarath Please buddys, try to help me Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19675 Posted March 22, 2020 Honorable Member Share Posted March 22, 2020 +1 Spoiler blocked user growing slowly 1 Link to comment Share on other sites More sharing options...
Nirray 192 Posted March 23, 2020 Share Posted March 23, 2020 self.RetryButton.SetEvent(ui.__mem_func__(self.RetryButton)) self.RecvButton.SetEvent(ui.__mem_func__(self.RecvButton)) https://docs.python.org/2/reference/datamodel.html Change function names to something like def OnClickRetryButton and def OnClickRecvButton, they cannot be the same like button names For example: self.serverSelectButton.SetEvent(ui.__mem_func__(self.serverSelectButton)) Instead of: self.serverSelectButton.SetEvent(ui.__mem_func__(self.__OnClickSelectServerButton)) Is going to throw same AttributeError which is stated as: 0323 01:00:01004 :: File "introLogin.py", line 714, in __LoadScript 0323 01:00:01005 :: File "ui.py", line 82, in __init__ 0323 01:00:01005 :: AttributeError 0323 01:00:01005 :: : 0323 01:00:01005 :: 'Button' object has no attribute 'im_func' 0323 01:00:01005 :: 1 I completely abandoned working on the files for this game. I do not respond to private messages. Link to comment Share on other sites More sharing options...
Kafa 153 Posted March 23, 2020 Author Share Posted March 23, 2020 (edited) Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal 1 Link to comment Share on other sites More sharing options...
Tunga 10 Posted March 24, 2020 Share Posted March 24, 2020 (edited) object and function name should be different. Edited March 24, 2020 by Tunga Link to comment Share on other sites More sharing options...
Kafa 153 Posted March 24, 2020 Author Share Posted March 24, 2020 1 hour ago, Tunga said: object and function name should be different. Thank you my friend, but i already solved it, and the system is done. thank you guys. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now