Reputation: 1
I'm new in wxpython module and I have a macOS Sierra, I'm trying to create a button, but it doesn't appear, furthermore I can't change the background color of panels, so I think that the problem is in the definition of panels, how can I fix it?
import wx
class MyApp(wx.App):
def OnInit(self):
self.frame=MyFrame(None,-1,title="Henry")
self.SetTopWindow(self.frame)
self.frame.Show()
return True
class MyFrame(wx.Frame):
def __int__(self,parent,id,title):
super(MyFrame, self).__init__(parent,id,title)
self.panel=wx.Panel(self)
self.panel.SetBackgroundColour(wx.BLACK) # it doesn't work
self.button=wx.Button(self.panel,label="premi",pos=(40,40)) # it doesn't work
if __name__=="__main__":
app=MyApp(False)
app.MainLoop()
The output of the script is only the default frame.
Upvotes: 0
Views: 144
Reputation: 6306
The problem is that you typoed the name of your MyFrame.__init__
method. You named it __int__
, so it is not called when you create an instance of MyFrame
.
Upvotes: 2