📜  wxPython-主要类

📅  最后修改于: 2020-11-05 04:57:54             🧑  作者: Mango


原始的wxWidgets(用C++编写)是一个巨大的类库。该库中的GUI类通过wxPython模块移植到Python ,该模块尝试尽可能接近原始wxWidgets库。因此,wxPython中的wx.Frame类的行为与其C++版本中的wxFrame类的行为大致相同。

wxObject是大多数类的基础。 wxApp的对象(wxPython中的wx.App)代表应用程序本身。生成GUI后,应用程序通过MainLoop()方法进入事件循环。下图描述了wxPython中包含的最常用的GUI类的类层次结构。

wxWindow层次结构wxGDIObject层次结构wxSizer层次结构wxButton层次结构

S.N. Classes & Description
1 wx.Frame

wx.Frame Class has a default constructor with no arguments.

2 wx.Panel

wx.Panel class is usually put inside a wxFrame object. This class is also inherited from wxWindow class.

3 wx.StaticText

wx.StaticText class object presents a control holding such read-only text. It can be termed as a passive control since it doesn’t produce any event.

4 TextCtrl

In wxPython, an object of wx.TextCtrl class serves this purpose. It is a control in which the text can be displayed and edited.

5 RadioButton & RadioBox

Each button, an object of wx.RadioButton class carries a text label next to a round button. wxPython API also consists of wx.RadioBox class. Its object offers a border and label to the group.

6 wx.CheckBox

A checkbox displays a small labeled rectangular box. When clicked, a checkmark appears inside the rectangle to indicate that a choice is made.

7 ComboBox & Choice Class

A wx.ComboBox object presents a list of items to select from. It can be configured to be a dropdown list or with permanent display. wxPython API contains a wx.Choice class, whose object is also a dropdown list, which is permanently read-only.

8 Wx.Gauge

Wx.Gauge class object shows a vertical or horizontal bar, which graphically shows incrementing quantity.

9 wx.Slider

wxPython API contains wx.Slider class. It offers same functionality as that of Scrollbar. Slider offers a convenient way to handle dragging the handle by slider specific wx.EVT_SLIDER event binder.

10 wx.MenuBar

A horizontal bar just below the title bar of a top level window is reserved to display a series of menus. It is an object of wx.MenuBar class in wxPython API.

11 wx.Toolbar

If the style parameter of wx.Toolbar object is set to wx.TB_DOCKABLE, it becomes dockable. A floating toolbar can also be constructed using wxPython’s AUIToolBar class.

12 Wx.Dialog

Although a Dialog class object appears like a Frame, it is normally used as a pop-up window on top of a parent frame. The objective of a Dialog is to collect some data from the user and send it to the parent frame.

13 wx.Notebook

wx.Notebook widget presents a tabbed control. One Notebook object in a frame has one or more tabs (called Pages), each of them having a panel showing the layout of controls.

14 wx.SplitterWindow

Object of this class is a layout manager, which holds two subwindows whose size can be changed dynamically by dragging the boundaries between them. The Splitter control gives a handle that can be dragged to resize the controls.

15 HTMLWindow

wxHTML library contains classes for parsing and displaying HTML content. Although this is not intended to be a full-featured browser, wx.HtmlWindow object is a generic HTML viewer.

16 ListBox & ListCtrl

A wx.ListBox widget presents a vertically scrollable list of strings. By default, a single item in the list is selectable. ListCtrl widget is a highly enhanced list display and selection tool. List of more than one column can be displayed in Report view, List view or Icon view.