# ! /Usr/bin/Python # -*-<Coding = UTF-8> -*- """ WxpythonProgramGiven by two necessary objects: Application object, that is, wx. app or its subclass object; top-level window object, that is, wx. frame or its subclass object; create a wx. sub-classes of the app. Four steps are required: 1. define this subclass; 2. write an oninit () method in the defined subclass 3. create an instance of this subclass in your program; 4. call the mainloop () method of the application instance, which gives control of the program to wxpython """ Import WX Class MyApp (wx. app ): # This is the first step. It defines the child class of Wx. App; # Compile oninit () method Def Oninit (Self ): """ Create a top-level window object in the Application object. Call the show method of the top-level window object to display it. """ Frame = Wx. Frame (ID =-1, parent = none, Pos = wx. defaultposition, size = Wx. defaultsize) frame. Show () # The oninit () method must return a bool value. Return True # Step 3: instantiate MyApp APP = MyApp () # Step 4: Call the mainloop Method App. mainloop ()