How to add an image in the menu?

2

I need to add an image in the menu of my program in Python. I am using the wxpython library. The menu looks 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 anyone help me with this? I researched all day and could not. It would be better if it were with image buttons, as I will need to add others later.

    
asked by anonymous 22.10.2016 / 02:51

1 answer

1

See if this section helps you:

self.bitmap = wx.Bitmap('imagem.jpg')
        wx.EVT_PAINT(self, self.OnPaint)

        self.Centre()

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

I removed this tuto here looks good ...

Vlw hope it helps

Anything goes on commenting ...

    
22.10.2016 / 04:03