fork download
  1. import wx
  2.  
  3. class MyFrame(wx.Frame):
  4. def __init__(self):
  5. wx.Frame.__init__(self, None, wx.ID_ANY, "title", size=(200,10))
  6. self.CreateStatusBar()
  7.  
  8. imgpath = "C:\\1.jpg"
  9. image = wx.Image( imgpath , wx.BITMAP_TYPE_ANY).ConvertToBitmap()
  10. image1 = wx.StaticBitmap( self, wx.ID_ANY, image )
  11. button1 = wx.Button( self, wx.ID_ANY, "test")
  12.  
  13. root_layout = wx.BoxSizer( wx.HORIZONTAL )
  14. root_layout.Add( image1 )
  15. root_layout.Add( button1 )
  16. root_layout.Fit( self )
  17.  
  18. class myApp(wx.App):
  19. def OnInit( self ):
  20. frame = MyFrame()
  21. frame.Show(True)
  22. return True
  23. def OnClose( evt ):
  24. wx.Exit()
  25.  
  26. def main():
  27. app = myApp()
  28. app.MainLoop()
  29.  
  30. if __name__ == '__main__':
  31. main()
Runtime error #stdin #stdout #stderr 0.01s 7892KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 1, in <module>
ImportError: No module named wx