[Tutor] Really basic won't run error
Phil
phillor9 at gmail.com
Sun Jul 4 03:17:39 EDT 2021
I've been working on this idea for most of the day and have finally
reduced the problem to a wxPython demo example but it won't run. No
doubt the reason is obvious but I cannot see it.
import wx
class ImagePanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)#None, title="Bitmap test")
wx.StaticText(self, -1, "This is a wx.StaticBitmap.", (45, 15))
bmp = 'test.jpg'.GetBitmap()
#mask = wx.Mask(bmp, wx.BLUE)
#bmp.SetMask(mask)
#StaticBitmap(self, -1, bmp, (80, 50), (bmp.GetWidth(),
bmp.GetHeight()))
StaticBitmap(self, -1, bmp, (80, 150))
if __name__ == "__main__":
app = wx.App()
frame = ImagePanel().Show()
app.MainLoop()
Traceback (most recent call last):
File "/usr/lib/python3.8/idlelib/run.py", line 559, in runcode
exec(code, self.locals)
File "/home/phil/Python/wxpython_bitmap.py", line 38, in <module>
frame = MyFrame().Show()
TypeError: __init__() missing 1 required positional argument: 'parent'
--
Regards,
Phil
More information about the Tutor
mailing list