第一个python的GUI程序

http://www.cublog.cn/u/25372/showart_311088.html

import sys, os
import wx
class main_window(wx.Frame):
     def __init__(self, parent, id, title):
         wx.Frame.__init__(self, parent, -1, title, size = (200, 100),
                           style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE)
         self.control = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE)
         self.Show(True)
         
class App(wx.App):
 def OnInit(self):
  frame = main_window(None, -1, "Title")
  self.SetTopWindow(frame)
  return 1
    
app = App(0)
app.MainLoop()

  今天用网上某人的第一个python的GUI程序测试,结果有一个警告:

  Warning (from warnings module):
  File "D:\Python25\gui_test.py", line 2
    from   wxPython.wx import *
DeprecationWarning: The wxPython compatibility package is no longer automatically generated or actively maintained.  Please switch to the wx package as soon as possible.

 改写为以上程序后,一切OK。

posted @ 2011-01-25 14:54  逍客1  阅读(298)  评论(0编辑  收藏  举报