3
I inserted a button with an image in my menu. But I can’t change its position. How do I change its position? because I need to insert 2 more buttons and organize them.I’m using the python wx library.
code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import wx
import wx.lib.buttons
class Frame(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()
How would you like to position them ?
– MagicHat
@Magichat this button I’d like to position at the top, center. The other two, further down, side by side, like a triangle.
– Ivo Queiroz