How to change the position of the bitmap button?

2

I inserted a button with an image in my menu. But I can not change its position. How do I change my position? because I need to insert 2 more buttons and organize them. I am using the python wx library.

menu image:

code:

#!/usr/bin/envpython#-*-coding:utf-8-*-importwximportwx.lib.buttonsclassFrame(wx.Frame):title="SEA - SunPy Environment Application"
    def __init__(self):
        wx.Frame.__init__(self, None, title=self.title, size=(800, 600))
        self.panel1 = wx.Panel(self, -1)
        self.createMainPanel()
        self.createMainMenu()


    def createMainPanel(self, color=(0, 0, 0)):
        panel = wx.Panel(self, id=wx.ID_ANY, pos=(0, 0), size=self.GetSize())
        panel.SetBackgroundColour('GRAY')

        bmp = wx.Bitmap("logo.jpg", wx.BITMAP_TYPE_ANY)
        button = wx.BitmapButton(panel,id=wx.ID_ANY, bitmap=bmp, size=(bmp.GetWidth()+10, bmp.GetHeight()+10))

        self.Centre()

    def OnPaint(self, event):
        dc = wx.PaintDC(self)
        dc.DrawBitmap(self.bitmap, 60, 20)

    def onQuit(self, event):
        self.Close()

class App(wx.App):
    def OnInit(self):
        self.mainScreen = Frame()
        self.SetTopWindow(self.mainScreen)
        self.mainScreen.Show()

        return True  

if __name__ == '__main__':
    app = App(False)
    app.MainLoop()
    
asked by anonymous 22.10.2016 / 06:14

1 answer

2

I added the attribute pos = (300,0) and it worked.

button = wx.BitmapButton (panel, id = wx.ID_ANY, pos = (300,0), bitmap = bmp, size = (bmp.GetWidth () + 10, bmp.GetHeight () + 10) / p>     

22.10.2016 / 15:16