Python论坛  - 讨论区

标题:[python-chinese] 用eclipse编写wxPython小程序,怎么窗体一闪就不见了,求教

2005年08月12日 星期五 13:23

jam.zheng jam.zheng at achievo.com
Fri Aug 12 13:23:35 HKT 2005

谢谢各位大侠!

Best regards,
* * * * * * *
Jam Zheng
Engineer of Software Section 1
Achievo China
Phone: (86-755) 2603-0128 X203
Fax:  (86-755) 2603-0138




[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年08月12日 星期五 13:44

Spirit Auding auding at gmail.com
Fri Aug 12 13:44:47 HKT 2005

代码在哪里?
我写的都没问题的。

On 8/12/05, jam.zheng <jam.zheng at achievo.com> wrote:
> 
> 谢谢各位大侠!
> 
> Best regards,
> * * * * * * *
> Jam Zheng
> Engineer of Software Section 1
> Achievo China
> Phone: (86-755) 2603-0128 X203
> Fax: (86-755) 2603-0138
> 
> 
> 
> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
> 



-- 
#############################################
# "your future depends on your dreams." so go to sleep.
# save water. shower with your girlfriend.
#
# Welcom2 : http//blog.csdn.net/auding1900/
#############################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050812/c0d25088/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年08月12日 星期五 13:53

jam.zheng jam.zheng at achievo.com
Fri Aug 12 13:53:23 HKT 2005

The code below:



import sys,os
from wxPython.wx import *
class main_window(wxFrame):
    def __init__(self,parent,id,title):
        wxFrame.__init__(self,parent,-1,title,size=(200,100),style=wxDEFAULT
_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
        self.Show(true)
class App(wxApp):
    def OnInit(self):
        frame=main_window(None,-1,"wxPython:(A Demonstration)")
        self.SetTopWindos(frame)
        return true
app=App(0)
app.MainLoop()

  -----Original Message-----
  From: python-chinese-bounces at lists.python.cn
[mailto:python-chinese-bounces at lists.python.cn]On Behalf Of Spirit Auding
  Sent: Friday, August 12, 2005 1:45 PM
  To: python-chinese at lists.python.cn
  Subject: Re: [python-chinese] 用eclipse编写wxPython小程序,怎么窗体一闪就
不见了,求教


  代码在哪里?
  我写的都没问题的。


  On 8/12/05, jam.zheng <jam.zheng at achievo.com> wrote:
    谢谢各位大侠!

    Best regards,
    * * * * * * *
    Jam Zheng
    Engineer of Software Section 1
    Achievo China
    Phone: (86-755) 2603-0128 X203
    Fax:  (86-755) 2603-0138



    _______________________________________________
    python-chinese list
    python-chinese at lists.python.cn
    http://python.cn/mailman/listinfo/python-chinese




  --
  #############################################
  #    "your future depends on your dreams." so go to sleep.
  #    save water. shower with your girlfriend.
  #
  #    Welcom2 : http//blog.csdn.net/auding1900/
  #############################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050812/939be42a/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年08月12日 星期五 14:19

Spirit Auding auding at gmail.com
Fri Aug 12 14:19:09 HKT 2005

试一下我的代码:

from wxPython.wx import *

ID_ABOUT = 101
ID_EXIT = 102

class MyFrame(wxFrame):
 def __init__(self, parent, ID, title):
 wxFrame.__init__(self, parent, ID, title, wxDefaultPosition, wxSize(200, 
150))
 self.CreateStatusBar()
 self.SetStatusText("This is the statusbar")

 menu = wxMenu()
 menu.Append(ID_ABOUT, "&About;","More information about this program")
 menu.AppendSeparator()
 menu.Append(ID_EXIT, "E&xit;", "Terminate the program")
 
 menuBar = wxMenuBar()
 menuBar.Append(menu, "&File;");

 self.SetMenuBar(menuBar)

 EVT_MENU(self, ID_ABOUT, self.OnAbout)
 EVT_MENU(self, ID_EXIT, self.TimeToQuit)

 def OnAbout(self, event):
 dlg = wxMessageDialog(self, "This sample program shows off\n"
 "frames, menus, statusbars, and this\n"
 "message dialog.",
 "About Me", wxOK | wxICON_INFORMATION)
 dlg.ShowModal()
 dlg.Destroy()

 def TimeToQuit(self, event):
 self.Close(True) 

class App(wxApp):
 def OnInit(self):
 frame = MyFrame(NULL, -1, "Hello from wxPython")
 frame.Show(True)
 self.SetTopWindow(frame)
 return True

if __name__ == "__main__":
 app = App(0)
 app.MainLoop()

我的Eclipse上可以运行的。

-- 
#############################################
# "your future depends on your dreams." so go to sleep.
# save water. shower with your girlfriend.
#
# Welcom2 : http//blog.csdn.net/auding1900/
#############################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050812/53dbaf46/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年08月12日 星期五 14:35

jam.zheng jam.zheng at achievo.com
Fri Aug 12 14:35:06 HKT 2005

高手,可以啊,很不错啊,能告诉我是什么原因吗?
我的代码也是从网上那个wxPython入门抄袭过来的!?!?!
  -----Original Message-----
  From: python-chinese-bounces at lists.python.cn
[mailto:python-chinese-bounces at lists.python.cn]On Behalf Of Spirit Auding
  Sent: Friday, August 12, 2005 2:19 PM
  To: python-chinese at lists.python.cn
  Subject: Re: [python-chinese] 用eclipse编写wxPython小程序,怎么窗体一闪就
不见了,求教


  试一下我的代码:

  from wxPython.wx import *

  ID_ABOUT = 101
  ID_EXIT  = 102

  class MyFrame(wxFrame):
      def __init__(self, parent, ID, title):
          wxFrame.__init__(self, parent, ID, title, wxDefaultPosition,
wxSize(200, 150))
          self.CreateStatusBar()
          self.SetStatusText("This is the statusbar")

          menu = wxMenu()
          menu.Append(ID_ABOUT, "&About;","More information about this
program")
          menu.AppendSeparator()
          menu.Append(ID_EXIT, "E&xit;", "Terminate the program")

          menuBar = wxMenuBar()
          menuBar.Append(menu, "&File;");

          self.SetMenuBar(menuBar)

          EVT_MENU(self, ID_ABOUT, self.OnAbout)
          EVT_MENU(self, ID_EXIT,  self.TimeToQuit)

      def OnAbout(self, event):
          dlg = wxMessageDialog(self, "This sample program shows off\n"
                                "frames, menus, statusbars, and this\n"
                                "message dialog.",
                                "About Me", wxOK | wxICON_INFORMATION)
          dlg.ShowModal()
          dlg.Destroy()

      def TimeToQuit(self, event):
          self.Close(True)

  class App(wxApp):
      def OnInit(self):
          frame = MyFrame(NULL, -1, "Hello from wxPython")
          frame.Show(True)
          self.SetTopWindow(frame)
          return True

  if __name__ == "__main__":
      app = App(0)
      app.MainLoop()

  我的Eclipse上可以运行的。

  --
  #############################################
  #    "your future depends on your dreams." so go to sleep.
  #    save water. shower with your girlfriend.
  #
  #    Welcom2 : http//blog.csdn.net/auding1900/
  #############################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050812/212e9797/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年08月12日 星期五 14:38

李戈强 ligeqq at 56.com
Fri Aug 12 14:38:00 HKT 2005

闪都不闪

是不是在eclipse中还要配库,(跟servlet一样?),如果要配怎么配?

 

我的eclisep显示

Traceback (most recent call last):

  File "d:\Documents and Settings\user\workspace\sixteen\wx.py", line 1, in
?

    from wxPython.wx import *

  File
"F:\Python24\Lib\site-packages\wx-2.6-msw-unicode\wxPython\__init__.py",
line 10, in ?

    import _wx

  File "F:\Python24\Lib\site-packages\wx-2.6-msw-unicode\wxPython\_wx.py",
line 3, in ?

    from _core import *

  File "F:\Python24\Lib\site-packages\wx-2.6-msw-unicode\wxPython\_core.py",
line 15, in ?

    import wx._core

  File "d:\Documents and Settings\user\workspace\sixteen\wx.py", line 1, in
?

    from wxPython.wx import *

ImportError: No module named wx

 

  _____  

发件人: python-chinese-bounces at lists.python.cn
[mailto:python-chinese-bounces at lists.python.cn] 代表 Spirit Auding
发送时间: 2005年8月12日 14:19
收件人: python-chinese at lists.python.cn
主题: Re: [python-chinese] 用eclipse编写wxPython小程序,怎么窗体一闪就不见
了,求教

 

试一下我的代码:

from wxPython.wx import *

ID_ABOUT = 101
ID_EXIT  = 102

class MyFrame(wxFrame):
    def __init__(self, parent, ID, title):
        wxFrame.__init__(self, parent, ID, title, wxDefaultPosition,
wxSize(200, 150))
        self.CreateStatusBar()
        self.SetStatusText("This is the statusbar")

        menu = wxMenu()
        menu.Append(ID_ABOUT, "&About;","More information about this
program")
        menu.AppendSeparator()
        menu.Append(ID_EXIT, "E&xit;", "Terminate the program")
        
        menuBar = wxMenuBar()
        menuBar.Append(menu, "&File;");

        self.SetMenuBar(menuBar)

        EVT_MENU(self, ID_ABOUT, self.OnAbout)
        EVT_MENU(self, ID_EXIT,  self.TimeToQuit)

    def OnAbout(self, event):
        dlg = wxMessageDialog(self, "This sample program shows off\n"
                              "frames, menus, statusbars, and this\n"
                              "message dialog.",
                              "About Me", wxOK | wxICON_INFORMATION)
        dlg.ShowModal()
        dlg.Destroy()

    def TimeToQuit(self, event):
        self.Close(True) 

class App(wxApp):
    def OnInit(self):
        frame = MyFrame(NULL, -1, "Hello from wxPython")
        frame.Show(True)
        self.SetTopWindow(frame)
        return True

if __name__ == "__main__":
    app = App(0)
    app.MainLoop()

我的Eclipse上可以运行的。

-- 
#############################################
#    "your future depends on your dreams." so go to sleep.
#    save water. shower with your girlfriend.
#
#    Welcom2 : http//blog.csdn.net/auding1900/ 
############################################# 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050812/7cc98d7a/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年08月12日 星期五 14:40

TianLiangLe alang.yl at gmail.com
Fri Aug 12 14:40:46 HKT 2005

frame=main_window(None,-1,"wxPython:(A Demonstration)")
 frame = MyFrame(NULL, -1, "Hello from wxPython")

还有,你的 frame.Show(True)是在frame初始化时做的,改到App里面去。
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050812/39f425a0/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年08月12日 星期五 14:41

weide wideweide at gmail.com
Fri Aug 12 14:41:54 HKT 2005

on 2005-8-12 14:19,Spirit Auding said the following:

> 试一下我的代码:
>
> from wxPython.wx import *
>
> ID_ABOUT = 101
> ID_EXIT = 102
>
> class MyFrame(wxFrame):
> def __init__(self, parent, ID, title):
> wxFrame.__init__(self, parent, ID, title, wxDefaultPosition,
> wxSize(200, 150))
> self.CreateStatusBar()
> self.SetStatusText("This is the statusbar")
>
> menu = wxMenu()
> menu.Append(ID_ABOUT, "&About;","More information about this program")
> menu.AppendSeparator()
> menu.Append(ID_EXIT, "E&xit;", "Terminate the program")
>
> menuBar = wxMenuBar()
> menuBar.Append(menu, "&File;");
>
> self.SetMenuBar(menuBar)
>
> EVT_MENU(self, ID_ABOUT, self.OnAbout)
> EVT_MENU(self, ID_EXIT, self.TimeToQuit)
>
> def OnAbout(self, event):
> dlg = wxMessageDialog(self, "This sample program shows off\n"
> "frames, menus, statusbars, and this\n"
> "message dialog.",
> "About Me", wxOK | wxICON_INFORMATION)
> dlg.ShowModal()
> dlg.Destroy()
>
> def TimeToQuit(self, event):
> self.Close(True)
>
> class App(wxApp):
> def OnInit(self):
> frame = MyFrame(NULL, -1, "Hello from wxPython")
> frame.Show(True)
> self.SetTopWindow(frame)
> return True
>
> if __name__ == "__main__":
> app = App(0)
> app.MainLoop()
>
> 我的Eclipse上可以运行的。
>
你用的是PyDev哪个版本?我装了0.9.7之后有个提示:
Unable to create this part due to an internal error. Reason for the
failure: The editor class could not be instantiated. This usually
indicates that the editor's class name was mistyped in plugin.xml.
根本就用不起来了。

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年08月12日 星期五 14:45

jam.zheng jam.zheng at achievo.com
Fri Aug 12 14:45:47 HKT 2005

高手:
   还有一点,我把一些text改成中文就不行了,是什么原因,如:
self.SetStatusText("This is the statusbar") 改为 self.SetStatusText("中文就
失败")
  -----Original Message-----
  From: python-chinese-bounces at lists.python.cn
[mailto:python-chinese-bounces at lists.python.cn]On Behalf Of Spirit Auding
  Sent: Friday, August 12, 2005 2:19 PM
  To: python-chinese at lists.python.cn
  Subject: Re: [python-chinese] 用eclipse编写wxPython小程序,怎么窗体一闪就
不见了,求教


  试一下我的代码:

  from wxPython.wx import *

  ID_ABOUT = 101
  ID_EXIT  = 102

  class MyFrame(wxFrame):
      def __init__(self, parent, ID, title):
          wxFrame.__init__(self, parent, ID, title, wxDefaultPosition,
wxSize(200, 150))
          self.CreateStatusBar()
          self.SetStatusText("This is the statusbar")

          menu = wxMenu()
          menu.Append(ID_ABOUT, "&About;","More information about this
program")
          menu.AppendSeparator()
          menu.Append(ID_EXIT, "E&xit;", "Terminate the program")

          menuBar = wxMenuBar()
          menuBar.Append(menu, "&File;");

          self.SetMenuBar(menuBar)

          EVT_MENU(self, ID_ABOUT, self.OnAbout)
          EVT_MENU(self, ID_EXIT,  self.TimeToQuit)

      def OnAbout(self, event):
          dlg = wxMessageDialog(self, "This sample program shows off\n"
                                "frames, menus, statusbars, and this\n"
                                "message dialog.",
                                "About Me", wxOK | wxICON_INFORMATION)
          dlg.ShowModal()
          dlg.Destroy()

      def TimeToQuit(self, event):
          self.Close(True)

  class App(wxApp):
      def OnInit(self):
          frame = MyFrame(NULL, -1, "Hello from wxPython")
          frame.Show(True)
          self.SetTopWindow(frame)
          return True

  if __name__ == "__main__":
      app = App(0)
      app.MainLoop()

  我的Eclipse上可以运行的。

  --
  #############################################
  #    "your future depends on your dreams." so go to sleep.
  #    save water. shower with your girlfriend.
  #
  #    Welcom2 : http//blog.csdn.net/auding1900/
  #############################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050812/e238a8d8/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年08月12日 星期五 14:54

Spirit Auding auding at gmail.com
Fri Aug 12 14:54:54 HKT 2005

我用的是PyDev 0.9.5版本,0.9.7那个版本我装了之后编辑器打不开Python文件,所以换回来了,原因不明。

 self.SetStatusText("中文就失败") 运行没问题,只是StatusBar上的显示不对,估计是没有指定编码导致的。

-- 
#############################################
# "your future depends on your dreams." so go to sleep.
# save water. shower with your girlfriend.
#
# Welcom2 : http//blog.csdn.net/auding1900/
#############################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050812/5f3682df/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年08月12日 星期五 14:55

jam.zheng jam.zheng at achievo.com
Fri Aug 12 14:55:07 HKT 2005

对了,高手,这个程序的用户界面框架很不错,先收藏先!
  能不能在这个基础上加一些toolbar,然后statsbar多分几栏,最好还有outlookbar
!希望高手们指教!如果有,请把代码发给大家分享,学习学习,小弟先谢过!
  -----Original Message-----
  From: python-chinese-bounces at lists.python.cn
[mailto:python-chinese-bounces at lists.python.cn]On Behalf Of Spirit Auding
  Sent: Friday, August 12, 2005 2:19 PM
  To: python-chinese at lists.python.cn
  Subject: Re: [python-chinese] 用eclipse编写wxPython小程序,怎么窗体一闪就
不见了,求教


  试一下我的代码:

  from wxPython.wx import *

  ID_ABOUT = 101
  ID_EXIT  = 102

  class MyFrame(wxFrame):
      def __init__(self, parent, ID, title):
          wxFrame.__init__(self, parent, ID, title, wxDefaultPosition,
wxSize(200, 150))
          self.CreateStatusBar()
          self.SetStatusText("This is the statusbar")

          menu = wxMenu()
          menu.Append(ID_ABOUT, "&About;","More information about this
program")
          menu.AppendSeparator()
          menu.Append(ID_EXIT, "E&xit;", "Terminate the program")

          menuBar = wxMenuBar()
          menuBar.Append(menu, "&File;");

          self.SetMenuBar(menuBar)

          EVT_MENU(self, ID_ABOUT, self.OnAbout)
          EVT_MENU(self, ID_EXIT,  self.TimeToQuit)

      def OnAbout(self, event):
          dlg = wxMessageDialog(self, "This sample program shows off\n"
                                "frames, menus, statusbars, and this\n"
                                "message dialog.",
                                "About Me", wxOK | wxICON_INFORMATION)
          dlg.ShowModal()
          dlg.Destroy()

      def TimeToQuit(self, event):
          self.Close(True)

  class App(wxApp):
      def OnInit(self):
          frame = MyFrame(NULL, -1, "Hello from wxPython")
          frame.Show(True)
          self.SetTopWindow(frame)
          return True

  if __name__ == "__main__":
      app = App(0)
      app.MainLoop()

  我的Eclipse上可以运行的。

  --
  #############################################
  #    "your future depends on your dreams." so go to sleep.
  #    save water. shower with your girlfriend.
  #
  #    Welcom2 : http//blog.csdn.net/auding1900/
  #############################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050812/86f521ca/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年08月12日 星期五 15:02

jam.zheng jam.zheng at achievo.com
Fri Aug 12 15:02:15 HKT 2005

又要麻烦您了,请问怎么指定,在哪儿指定编码?
  -----Original Message-----
  From: python-chinese-bounces at lists.python.cn
[mailto:python-chinese-bounces at lists.python.cn]On Behalf Of Spirit Auding
  Sent: Friday, August 12, 2005 2:55 PM
  To: python-chinese at lists.python.cn
  Subject: Re: [python-chinese] 用eclipse编写wxPython小程序,怎么窗体一闪就
不见了,求教


  我用的是PyDev 0.9.5版本,0.9.7那个版本我装了之后编辑器打不开Python文件,所
以换回来了,原因不明。

      self.SetStatusText("中文就失败")   运行没问题,只是StatusBar上的显示不
对,估计是没有指定编码导致的。

  --
  #############################################
  #    "your future depends on your dreams." so go to sleep.
  #    save water. shower with your girlfriend.
  #
  #    Welcom2 : http//blog.csdn.net/auding1900/
  #############################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050812/345a6c6d/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年08月12日 星期五 15:22

Spirit Auding auding at gmail.com
Fri Aug 12 15:22:18 HKT 2005

我也是刚刚开始练,怎么修理我也没搞定,什么原因也是讲不清楚……

不好意思啦…………

-- 
#############################################
# "your future depends on your dreams." so go to sleep.
# save water. shower with your girlfriend.
#
# Welcom2 : http//blog.csdn.net/auding1900/
#############################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050812/33e7b473/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年08月12日 星期五 15:41

李戈强 ligeqq at 56.com
Fri Aug 12 15:41:05 HKT 2005

请教一下,你们的eclipse是怎么配的

我的一运行就显示

Traceback (most recent call last):

  File "d:\Documents and Settings\user\workspace\sixteen\wx.py", line 1, in
?

    from wxPython.wx import *

  File
"F:\Python24\Lib\site-packages\wx-2.6-msw-unicode\wxPython\__init__.py",
line 10, in ?

    import _wx

  File "F:\Python24\Lib\site-packages\wx-2.6-msw-unicode\wxPython\_wx.py",
line 3, in ?

    from _core import *

  File "F:\Python24\Lib\site-packages\wx-2.6-msw-unicode\wxPython\_core.py",
line 15, in ?

    import wx._core

  File "d:\Documents and Settings\user\workspace\sixteen\wx.py", line 1, in
?

    from wxPython.wx import *

ImportError: No module named wx

 

但是在命令行下就可以运行,能够出那个小窗口。

 

  _____  

发件人: python-chinese-bounces at lists.python.cn
[mailto:python-chinese-bounces at lists.python.cn] 代表 jam.zheng
发送时间: 2005年8月12日 14:55
收件人: python-chinese at lists.python.cn
主题: RE: [python-chinese] 用eclipse编写wxPython小程序,怎么窗体一闪就不见
了,求教

 

对了,高手,这个程序的用户界面框架很不错,先收藏先!

  能不能在这个基础上加一些toolbar,然后statsbar多分几栏,最好还有
outlookbar!希望高手们指教!如果有,请把代码发给大家分享,学习学习,小弟先谢
过!

-----Original Message-----
From: python-chinese-bounces at lists.python.cn
[mailto:python-chinese-bounces at lists.python.cn]On Behalf Of Spirit Auding
Sent: Friday, August 12, 2005 2:19 PM
To: python-chinese at lists.python.cn
Subject: Re: [python-chinese] 用eclipse编写wxPython小程序,怎么窗体一闪就不
见了,求教

试一下我的代码:

from wxPython.wx import *

ID_ABOUT = 101
ID_EXIT  = 102

class MyFrame(wxFrame):
    def __init__(self, parent, ID, title):
        wxFrame.__init__(self, parent, ID, title, wxDefaultPosition,
wxSize(200, 150))
        self.CreateStatusBar()
        self.SetStatusText("This is the statusbar")

        menu = wxMenu()
        menu.Append(ID_ABOUT, "&About;","More information about this
program")
        menu.AppendSeparator()
        menu.Append(ID_EXIT, "E&xit;", "Terminate the program")
        
        menuBar = wxMenuBar()
        menuBar.Append(menu, "&File;");

        self.SetMenuBar(menuBar)

        EVT_MENU(self, ID_ABOUT, self.OnAbout)
        EVT_MENU(self, ID_EXIT,  self.TimeToQuit)

    def OnAbout(self, event):
        dlg = wxMessageDialog(self, "This sample program shows off\n"
                              "frames, menus, statusbars, and this\n"
                              "message dialog.",
                              "About Me", wxOK | wxICON_INFORMATION)
        dlg.ShowModal()
        dlg.Destroy()

    def TimeToQuit(self, event):
        self.Close(True) 

class App(wxApp):
    def OnInit(self):
        frame = MyFrame(NULL, -1, "Hello from wxPython")
        frame.Show(True)
        self.SetTopWindow(frame)
        return True

if __name__ == "__main__":
    app = App(0)
    app.MainLoop()

我的Eclipse上可以运行的。

-- 
#############################################
#    "your future depends on your dreams." so go to sleep.
#    save water. shower with your girlfriend.
#
#    Welcom2 : http//blog.csdn.net/auding1900/ 
############################################# 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050812/5cadf1d8/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年08月12日 星期五 17:55

freeman freeman_z at 163.com
Fri Aug 12 17:55:24 HKT 2005

pydev 0.97 要在jdk1.5上运行.-_-




[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年08月14日 星期日 19:05

limodou limodou at gmail.com
Sun Aug 14 19:05:49 HKT 2005

在 05-8-12,Spirit Auding<auding at gmail.com> 写道:
> 我用的是PyDev 0.9.5版本,0.9.7那个版本我装了之后编辑器打不开Python文件,所以换回来了,原因不明。
>  
>      self.SetStatusText("中文就失败")  
> 运行没问题,只是StatusBar上的显示不对,估计是没有指定编码导致的。
> 

如果你使用的是unicocde版本的wxPython,在程序中是不能直接使用中文的,而要先在程序开头加上文件编程声明:

#coding=gb2312

然后在所有有中文的地方使用u来处理中文。但这种方法只是对文件中直接出现的中文有效,因为python会自动将带u的中文转为unicode,这样在unicode版本下的wxPython中使用就没有问题了。但对于从文件之类的原本不是unicode编码的地方读出来的中文串,则还需要进行转码处理才可以。


-- 
I like python! 
My Donews Blog: http://www.donews.net/limodou

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号