开发者

How can I blit a pgu gui object in pygame

开发者 https://www.devze.com 2022-12-26 03:00 出处:网络
I have image.I am tr开发者_如何转开发ying to load a button on it.The image I\'m loading using pygame.image.load function.I\'m using pgu gui library with pygame to create a gui.button.Now I have to bli

I have image.I am tr开发者_如何转开发ying to load a button on it.The image I'm loading using pygame.image.load function.I'm using pgu gui library with pygame to create a gui.button.Now I have to blit this button on the image.


You will first create a app container "over" the image, and then add the button to this frame, like this:

    from pgu import gui 
    my_app = gui.App()
    my_container = gui.Container(width =1200,height = 900)#or whatever width, height you wish
    my_button = gui.Button("Quit")
    app.connect(gui.QUIT,app.quit,None)

    ##The button CLICK event is connected to the app.close method.  

    my_button.connect(gui.CLICK,app.quit,None)
    my_container.add(my_button,100,100)'

I hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消