每个wxpython程序必须有一个application对象(wx.app的一个实例)和至少一个frame对象。
语句解释:
frame=wx.Frame(parent=None,title=’Bare’)
wx.Frame()函数的描述:#+++++来自wxWidgets 2.8.11+++++++++++++++++++++++++++++++++++++++++++++++++
wxFrame(wxWindow* parent, wxWindowID id, const wxString& title, constwxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,long style = wxDEFAULT_FRAME_STYLE, const wxString& name =\"frame\")
Constructor, creating the window. (构造函数,创建一个窗口)Parameters(参数解释)
Parent(父窗口或者所属的上级窗口,注意没有初始值,所以必须给这个参数赋值)
The window parent. This may be NULL. If it is non-NULL, the frame willalways be displayed on top of the parent window on Windows.(不懂,找个例子理解???)
Id(按道理:这个参数没有初始值,必须给这个参数赋值,但是实际中不是这样,??)
问题己解决,因为这个文档是描述的wxwidgets而不是wxpython,虽然wxpython来自于wxwidgets.但是还是有所不同,可以参考,但要检验。
The window identifier(标识既ID). It may take a value of -1 toindicate(指出) a default value(如果值是-1指出是一个默认的值,这个默认的值是个什么值,如果改变的话怎么改).可以查wxpython文档import wx
class App(wx.App): def OnInit(self):
frame=wx.Frame(parent=None,title='bare')
frame.Show() return True
#if __name__ == '__main__':app=App()
app.MainLoop()可以运行,同样:import wx
class App(wx.App): def OnInit(self):
frame=wx.Frame(parent=None) frame.Show() return True
#if __name__ == '__main__':app=App()
app.MainLoop()
也可以运行,同样:import wx
class App(wx.App): def OnInit(self):
frame=wx.Frame(parent=None,id=-1) frame.Show() return True
#if __name__ == '__main__':app=App()
app.MainLoop()
也可以运行。?????
Title(按道理:没有初始值,必须给这个参数赋值)The caption to be displayed on the frame's title bar.
pos (注意在函数的描述中,变量名后有=号的,既表明这个变量有初始值,不赋值将会自动调用默认值,所以这个参数可以不赋值)
The window position. A value of (-1, -1) indicates a default position, chosenby either the windowing system or wxWidgets, depending on platform.
size (注意在函数的描述中,变量名后有=号的,既表明这个变量有初始值,不赋值将会自动调用默认值,所以这个参数可以不赋值)
The window size. A value of (-1, -1) indicates a default size, chosen by eitherthe windowing system or wxWidgets, depending on platform.
style (注意在函数的描述中,变量名后有=号的,既表明这个变量有初
始值,不赋值将会自动调用默认值,所以这个参数可以不赋值)The window style. See wxFrame.
name (注意在函数的描述中,变量名后有=号的,既表明这个变量有初始值,不赋值将会自动调用默认值,所以这个参数可以不赋值)
The name of the window. This parameter is used to associate a name with theitem, allowing the application user to set Motif resource values for individualwindows.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- 69lv.com 版权所有 湘ICP备2023021910号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务