3
I need to add an image to the menu of my program in Python. I am using the wxpython library. The menu is like this:
The code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import wx
class Frame(wx.Frame):
title = "SEA"
def __init__(self):
wx.Frame.__init__(self, None, title=self.title, size=(800, 600))
self.panel1 = wx.Panel(self, -1)
self.createMainPanel()
self.createMainMenu()
self.Centre()
def createMainPanel(self, color=(0, 0, 0)):
panel = wx.Panel(self, id=wx.ID_ANY, pos=(0, 0), size=self.GetSize())
panel.SetBackgroundColour('GRAY')
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()
I want to add the following image in the menu, at the top, aligned to the center, which is this:
Can someone help me with that? I’ve been doing my research all day and I couldn’t. It would be better if it were with picture buttons, because I will need to add others later.
worked, the problem was the gray background I put, was capping the image. Thank you!
– Ivo Queiroz
@Ivoqueiroz if any of the answers is correct, could validate it by clicking on the green icon below the evaluation arrows... Vlw...
– MagicHat
thanks! you know how I can position this image in the menu?
– Ivo Queiroz
Open a new question, sometimes other users can search for this question too, when formulating the question, see if you already have no answer...
– MagicHat