2005年02月07日 星期一 13:07
sys是built-in module On Sun, 6 Feb 2005 20:37:05 +0800, 唐国巍 <tgw_cl at 163.net> wrote: > python-chinese,您好! > > 经常在文件开头看到这样的引用import sys,可是搜遍了目录也找不到这个sys.py在哪,这是怎么回事 > > 致 > 礼! > > 唐国巍 > tgw_cl at 163.net > 2005-02-06 > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > > > -- Excellent FOSS (Free/Open Source Software): Get Firefox! http://www.spreadfirefox.com/?q=affiliates&id=67907&t=1 Reclaim Your Inbox! http://www.spreadfirefox.com/?q=affiliates&id=67907&t=183
2005年02月07日 星期一 17:52
python-chinese,您好! from wxPython.wx import * class MyFrame(wxFrame): def __init__(self, parent, ID, title): wxFrame.__init__(self, parent, ID, title, wxPoint(100,100), wxSize(500, 300)) #dlg = wxDialog(None,-1,'Hey',size=(200,200)) self.bt_1 = wxButton(self, 15, "Press me!", wxPoint(25,15), wxSize(50,50)) EVT_BUTTON(self.bt_1, -1, self.bt_1_OnButtonClick) def bt_1_OnButtonClick(self,event): self.bt_1.SetSize((100, 100)) self.sz_11 = wxBoxSizer(wxVERTICAL) self.SetSizer(self.sz_11);self.SetAutoLayout(true);self.Layout();self.Refresh() class MyApp(wxApp): def OnInit(self): Frame = MyFrame(NULL, -1, "Hello from wxPython") Frame.Show(true) self.SetTopWindow(Frame) return true app = MyApp(0) app.MainLoop() 上面这段代码,我是要单击按钮后,按钮大小改变。可是有错误提示,AttributeError: 'MyFrame' object has no attribute 'bt_1_OnButtonClick'。 致 礼! 唐国巍 tgw_cl at 163.net 2005-02-07
2005年02月07日 星期一 18:24
唐国巍,您好! 我知道了,是因为ID的问题吧。 ======= 2005-02-07 17:52:00 您在来信中写道:======= >python-chinese,您好! > >from wxPython.wx import * > >class MyFrame(wxFrame): > def __init__(self, parent, ID, title): > wxFrame.__init__(self, parent, ID, title, > wxPoint(100,100), wxSize(500, 300)) > #dlg = wxDialog(None,-1,'Hey',size=(200,200)) > self.bt_1 = wxButton(self, 15, "Press me!", wxPoint(25,15), wxSize(50,50)) > EVT_BUTTON(self.bt_1, -1, self.bt_1_OnButtonClick) > def bt_1_OnButtonClick(self,event): > self.bt_1.SetSize((100, 100)) > > self.sz_11 = wxBoxSizer(wxVERTICAL) > self.SetSizer(self.sz_11);self.SetAutoLayout(true);self.Layout();self.Refresh() > >class MyApp(wxApp): > def OnInit(self): > Frame = MyFrame(NULL, -1, "Hello from wxPython") > Frame.Show(true) > self.SetTopWindow(Frame) > return true > >app = MyApp(0) >app.MainLoop() > >上面这段代码,我是要单击按钮后,按钮大小改变。可是有错误提示,AttributeError: 'MyFrame' object has no attribute 'bt_1_OnButtonClick'。 > 致 >礼! > > > 唐国巍 > tgw_cl at 163.net > 2005-02-07 >_______________________________________________ >python-chinese list >python-chinese at lists.python.cn >http://python.cn/mailman/listinfo/python-chinese > = = = = = = = = = = = = = = = = = = = = 致 礼! 唐国巍 tgw_cl at 163.net 2005-02-07
Zeuux © 2025
京ICP备05028076号