kodepiko 38 Posted May 29, 2016 Share Posted May 29, 2016 Hello, I'm trying to add MouseIn tooltip to ImageBox at uiRefine.py (I want hover tooltip with item description on refine materials icon for ex. red pearl etc) I try this code at AppendMaterial() slot = self.__MakeSlot() slot.SetParent(self) slot.SetPosition(15, self.dialogHeight) itemImage = self.__MakeItemImage() itemImage.SetParent(slot) item.SelectItem(vnum) itemImage.LoadImage(item.GetIconImageFileName()) # self.itemImage = itemImage # this is defined somewhere else self.itemImage.OnMouseOverIn(self.ShowTip()) self.itemImage.OnMouseOverOut(self.HideTip()) I init tooltip at def Open(): self.txttooltip = uiToolTip.ToolTip() self.txttooltip.HideToolTip() but get syserr: 0529 13:54:42313 :: TypeError 0529 13:54:42313 :: : 0529 13:54:42313 :: OnMouseOverIn() takes exactly 1 argument (2 given) 0529 13:54:42313 :: When I do self.itemImage.OnMouseOverIn = self.ShowTip() syserr is clear but there's no tooltip, so I think it's bad use of this function My defs: def ShowTip(self): self.txttooltip.ClearToolTip() self.txttooltip.AppendTextLine("Description") self.txttooltip.Show() def HideTip(self): self.txttooltip.Hide() Anyone know how to do this? Greetings. Link to comment Share on other sites More sharing options...
Shang 368 Posted May 29, 2016 Share Posted May 29, 2016 41 minutes ago, kodepiko said: Hello, I'm trying to add MouseIn tooltip to ImageBox at uiRefine.py (I want hover tooltip with item description on refine materials icon for ex. red pearl etc) I try this code at AppendMaterial() slot = self.__MakeSlot() slot.SetParent(self) slot.SetPosition(15, self.dialogHeight) itemImage = self.__MakeItemImage() itemImage.SetParent(slot) item.SelectItem(vnum) itemImage.LoadImage(item.GetIconImageFileName()) # self.itemImage = itemImage # this is defined somewhere else self.itemImage.OnMouseOverIn(self.ShowTip()) self.itemImage.OnMouseOverOut(self.HideTip()) I init tooltip at def Open(): self.txttooltip = uiToolTip.ToolTip() self.txttooltip.HideToolTip() but get syserr: 0529 13:54:42313 :: TypeError 0529 13:54:42313 :: : 0529 13:54:42313 :: OnMouseOverIn() takes exactly 1 argument (2 given) 0529 13:54:42313 :: When I do self.itemImage.OnMouseOverIn = self.ShowTip() syserr is clear but there's no tooltip, so I think it's bad use of this function My defs: def ShowTip(self): self.txttooltip.ClearToolTip() self.txttooltip.AppendTextLine("Description") self.txttooltip.Show() def HideTip(self): self.txttooltip.Hide() Anyone know how to do this? Greetings. self.itemImage.OnMouseOverIn(self.ShowTip)self.itemImage.OnMouseOverOut(self.HideTip) 1 Link to comment Share on other sites More sharing options...
kodepiko 38 Posted May 29, 2016 Author Share Posted May 29, 2016 2 hours ago, Shang said: self.itemImage.OnMouseOverIn(self.ShowTip)self.itemImage.OnMouseOverOut(self.HideTip) Yeah, I tried it but still got OnMouseOverIn() takes exactly 1 argument (2 given) I don't pass any arguments with this function so crazy thing.. My uirefine: http://pastebin.com/2xNxHx4C Link to comment Share on other sites More sharing options...
Shang 368 Posted May 29, 2016 Share Posted May 29, 2016 2 hours ago, kodepiko said: Yeah, I tried it but still got OnMouseOverIn() takes exactly 1 argument (2 given) I don't pass any arguments with this function so crazy thing.. My uirefine: http://pastebin.com/jp6iFezF Pastebin not available. Can you share your ui.py? 1 Link to comment Share on other sites More sharing options...
kodepiko 38 Posted May 29, 2016 Author Share Posted May 29, 2016 7 minutes ago, Shang said: Pastebin not available. uirefine: http://pastebin.com/2xNxHx4C ui.py: http://pastebin.com/2aE7vkxy Here it is, damn it should be easy but I don't know how to make it works Link to comment Share on other sites More sharing options...
Developer PACI 917 Posted May 29, 2016 Developer Share Posted May 29, 2016 OnMouseOverIn() and OnMouseOverOut() are the called to run the MouseEvent functions, you can't use them to set a mouse event. You better use: self.itemImage.SAFE_SetStringEvent("MOUSE_OVER_IN", self.ShowToolTip) self.itemImage.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.HideToolTip) 2 when you return 0 and server doesn't boot: Link to comment Share on other sites More sharing options...
kodepiko 38 Posted May 29, 2016 Author Share Posted May 29, 2016 (edited) 44 minutes ago, PACI said: OnMouseOverIn() and OnMouseOverOut() are the called to run the MouseEvent functions, you can't use them to set a mouse event. You better use: self.itemImage.SAFE_SetStringEvent("MOUSE_OVER_IN", self.ShowToolTip) self.itemImage.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.HideToolTip) Thanks, now syserr is clear but nothing happens when I point at image of weapon or pearl I just want to put tooltip item description when you point at materials of upgrading Edited August 20, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
metin2-factory 1008 Posted May 29, 2016 Share Posted May 29, 2016 (edited) 2 hours ago, kodepiko said: Thanks, now syserr is clear but nothing happens when I point at image of weapon or pearl I just want to put tooltip item description when you point at materials of upgrading Well,if you copied paste what PACI wrote of course it wouldn't work. Modify it to match your functions.. self.itemImage.SAFE_SetStringEvent("MOUSE_OVER_IN", self.ShowTip) self.itemImage.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.HideTip) Does it appear like this in your code? Also,make sure not to add () in the end. Edited August 20, 2022 by Metin2 Dev Core X - External 2 Internal 2 Link to comment Share on other sites More sharing options...
Developer PACI 917 Posted May 29, 2016 Developer Share Posted May 29, 2016 That's right, I haven't seen your tooltip events, so you must edit those sentences with your tooltip events' name. 1 when you return 0 and server doesn't boot: Link to comment Share on other sites More sharing options...
kodepiko 38 Posted May 29, 2016 Author Share Posted May 29, 2016 1 hour ago, PACI said: That's right, I haven't seen your tooltip events, so you must edit those sentences with your tooltip events' name. Of course I do, my tooltip functions are def ShowTip(self): self.txttooltip.ClearToolTip() self.txttooltip.AppendTextLine("Description") self.txttooltip.Show() def HideTip(self): self.txttooltip.Hide() and I use at def AppendMaterial(): self.itemImage.SAFE_SetStringEvent("MOUSE_OVER_IN", self.ShowTip) self.itemImage.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.HideTip) 1 hour ago, metin2-factory said: Well,if you copied paste what PACI wrote of course it wouldn't work. Modify it to match your functions.. self.itemImage.SAFE_SetStringEvent("MOUSE_OVER_IN", self.ShowTip) self.itemImage.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.HideTip) Does it appear like this in your code? Also,make sure not to add () in the end. Obviously if I would do that syserr will not be clear because I don't have that defs, I said syserr is clear I try with chat function to see it correctly triggering those functions or not @update Okay, it doesn't trigger so it must be bad trigger on itemImage (but it should work for item material icons) DONE. #Thread solved. Thanks for trying to help guys, SAFE_SetStringEvent("MOUSE_OVER_OUT") works like a charm in this case @metin2-factory - it worked as described in this topic, nothing more to add 1 Link to comment Share on other sites More sharing options...
metin2-factory 1008 Posted May 29, 2016 Share Posted May 29, 2016 37 minutes ago, kodepiko said: Of course I do, my tooltip functions are def ShowTip(self): self.txttooltip.ClearToolTip() self.txttooltip.AppendTextLine("Description") self.txttooltip.Show() def HideTip(self): self.txttooltip.Hide() and I use at def AppendMaterial(): self.itemImage.SAFE_SetStringEvent("MOUSE_OVER_IN", self.ShowTip) self.itemImage.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.HideTip) Obviously if I would do that syserr will not be clear because I don't have that defs, I said syserr is clear I try with chat function to see it correctly triggering those functions or not @update Okay, it doesn't trigger so it must be bad trigger on itemImage (but it should work for item material icons) DONE. #Thread solved. Thanks for trying to help guys, SAFE_SetStringEvent("MOUSE_OVER_OUT") works like a charm in this case You should write what you did so people with same problem can solve it by reading this topic 1 Link to comment Share on other sites More sharing options...
kodepiko 38 Posted May 29, 2016 Author Share Posted May 29, 2016 Do you guys have idea how to get item vnum or icon name of image I point with cursor? because I can't select item at this tooltip, I can't pass any arguments through the MOUSE_OVER function yep? like itemImage.SAFE_SetStringEvent("MOUSE_OVER_IN", self.ShowTip("description")) - any ideas how to do item description of materials when I point them? I just need to select item, but when I point material image I can't get any informations like vnum, is there a function which can get icon name by pointing on them? (without select item) When I use item.getdescription directly at ShowTip function it just uses last selected item (for ex weapon or blessing scroll) Link to comment Share on other sites More sharing options...
VegaS 1085 Posted May 29, 2016 Share Posted May 29, 2016 I see you want to use for description in refine, you can start with this: def OverInItem(self, value_t): global description_refine import grp if description_refine: table_description = { 30501 : ["[1] Value text","[2] Value text","[3] Value text"], 30502 : ["[1] Value text","[2] Value text","[3] Value text"], 30503 : ["[1] Value text","[2] Value text","[3] Value text"], 30504 : ["[1] Value text","[2] Value text","[3] Value text"], 30505 : ["[1] Value text","[2] Value text","[3] Value text"], 30506 : ["[1] Value text","[2] Value text","[3] Value text"], } try: self.tooltipItem.ClearToolTip() item.SelectItem(description_refine[value_t]) self.tooltipItem.AutoAppendTextLine("%s" % item.GetItemName(), self.tooltipItem.TITLE_COLOR) self.tooltipItem.AppendSpace(5) self.tooltipItem.AutoAppendTextLine("Test value:", self.SPECIAL_POSITIVE_COLOR) for i in xrange(len(table_description[description_refine[value_t]])): self.tooltipItem.AutoAppendTextLine("%s" % table_description[description_refine[value_t]][i]) self.tooltipItem.AlignHorizonalCenter() self.tooltipItem.ShowToolTip() except: pass 1 Link to comment Share on other sites More sharing options...
kodepiko 38 Posted May 29, 2016 Author Share Posted May 29, 2016 51 minutes ago, VegaS said: I see you want to use for description in refine, you can start with this: def OverInItem(self, value_t): global description_refine import grp if description_refine: table_description = { 30501 : ["[1] Value text","[2] Value text","[3] Value text"], 30502 : ["[1] Value text","[2] Value text","[3] Value text"], 30503 : ["[1] Value text","[2] Value text","[3] Value text"], 30504 : ["[1] Value text","[2] Value text","[3] Value text"], 30505 : ["[1] Value text","[2] Value text","[3] Value text"], 30506 : ["[1] Value text","[2] Value text","[3] Value text"], } try: self.tooltipItem.ClearToolTip() item.SelectItem(description_refine[value_t]) self.tooltipItem.AutoAppendTextLine("%s" % item.GetItemName(), self.tooltipItem.TITLE_COLOR) self.tooltipItem.AppendSpace(5) self.tooltipItem.AutoAppendTextLine("Test value:", self.SPECIAL_POSITIVE_COLOR) for i in xrange(len(table_description[description_refine[value_t]])): self.tooltipItem.AutoAppendTextLine("%s" % table_description[description_refine[value_t]][i]) self.tooltipItem.AlignHorizonalCenter() self.tooltipItem.ShowToolTip() except: pass Yes but at ImageBox class I can't pass functions any arguments like vnum so I can't show description correctly for the item, so this is only table, of course I can storage itemdescription of item and his vnum and at tooltip just show it, but I don't know how to get icon name or vnum (so I can't get description from array because I don't know index of item I'm pointing and cant pass argument like this: itemImage.SAFE_SetStringEvent("MOUSE_OVER_IN", self.ShowTip(index)) ) which I'm pointing on with cursor Link to comment Share on other sites More sharing options...
VegaS 1085 Posted May 30, 2016 Share Posted May 30, 2016 (edited) Check my profile and add me in skype, and i help you with function for look like that: Edited August 20, 2022 by Metin2 Dev Core X - External 2 Internal 1 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