How to create and use wxapp application objects

Source: Internet
Author: User
#  ! /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 ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.