Jump to content

How to add buttons


Go to solution Solved by Koray,

Recommended Posts

Hello i have 2 problems



i would like to udnerstand how to add buttons over here
if someone is so nice to answer , can make a little exemple
with just 1 button
so i can adapt your exemple .... please?


KVdMWJ3.png





second problem
i would like also to understand how to make
a vertical side taskbar on the left part of the game screen
something like that:  from martyinsama
, but  there is a button, when do u press that button, it open
That scroll task bar...with other buttons inside


F6KfICI.png

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Active Member
  • Solution

First, you create any image for background

 

Create your board base with background 

 

self.backg = ui.ImageBox()
self.backg.LoadImage("BoardBackGround.tga") #your background image name
self.backg.SetPosition(x, y)#change by yourself
self.backg.Show()
 
Add button in your imagebox(image board)
self.backg_button = ui.Button()
self.backg_button.SetParent(self.backg) #your image board parent
self.backg_button.SetPosition(x,y) #Change by yourself
self.backg_button.SetUpVisual('d:/ymir work/ui/public/close_button_01.sub')   #"""
self.backg_button.SetOverVisual('d:/ymir work/ui/public/close_button_02.sub') #Change by yourself
self.backg_button.SetDownVisual('d:/ymir work/ui/public/close_button_03.sub') #"""
self.backg_button.SetEvent(ui.__mem_func__(self.__ButtonFuncInHere))
self.backg_button.Show()
 
Create your button function
def __ButtonFuncInHere(self):
     #Func in here
Link to comment
Share on other sites

i have errors
can someone tell me exactly in which python files should i have to write
these things

and exactly under which line or something i can understand where is it?

because i did as koray told me, but i got nothing, i m not sure i had implemented it in the correct python file
and under the correct lines

please someone can help me?

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.