最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

基于wxpython實現的windows GUI程序實例

 更新時間:2015年05月30日 10:49:53   作者:皮蛋  
這篇文章主要介紹了基于wxpython實現的windows GUI程序,實例分析了windows GUI程序的相關實現技巧,需要的朋友可以參考下

本文實例講述了基于wxpython實現的windows GUI程序。分享給大家供大家參考。具體如下:

# using a wx.Frame, wx.MenuBar, wx.Menu, wx.Panel, wx.StaticText, wx.Button, 
# and a wx.BoxSizer to show a rudimentary wxPython Windows GUI application
# wxPython package from: http://prdownloads.sourceforge.net/wxpython/
# I downloaded: wxPython2.5-win32-ansi-2.5.3.1-py23.exe
# if you have not already done so install the Python compiler first
# I used Python-2.3.4.exe (the Windows installer package for Python23) 
# from http://www.python.org/2.3.4/
# tested with Python23   vegaseat   24jan2005
import wx
class Frame1(wx.Frame):
  # create a simple windows frame (sometimes called form)
  # pos=(ulcX,ulcY) size=(width,height) in pixels
  def __init__(self, parent, title):
    wx.Frame.__init__(self, parent, -1, title, pos=(150, 150), size=(350, 250))
    # create a menubar at the top of the user frame
    menuBar = wx.MenuBar()
    # create a menu ... 
    menu = wx.Menu()
    # ... add an item to the menu
    # \tAlt-X creates an accelerator for Exit (Alt + x keys)
    # the third parameter is an optional hint that shows up in 
    # the statusbar when the cursor moves across this menu item
    menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit the program")
    # bind the menu event to an event handler, share QuitBtn event
    self.Bind(wx.EVT_MENU, self.OnQuitButton, id=wx.ID_EXIT)
    # put the menu on the menubar
    menuBar.Append(menu, "&File")
    self.SetMenuBar(menuBar)
    # create a status bar at the bottom of the frame
    self.CreateStatusBar()
    # now create a panel (between menubar and statusbar) ...
    panel = wx.Panel(self)
    # ... put some controls on the panel
    text = wx.StaticText(panel, -1, "Hello World!")
    text.SetFont(wx.Font(24, wx.SCRIPT, wx.NORMAL, wx.BOLD))
    text.SetSize(text.GetBestSize())
    quitBtn = wx.Button(panel, -1, "Quit")
    messBtn = wx.Button(panel, -1, "Message")
    # bind the button events to event handlers
    self.Bind(wx.EVT_BUTTON, self.OnQuitButton, quitBtn)
    self.Bind(wx.EVT_BUTTON, self.OnMessButton, messBtn)
    # use a sizer to layout the controls, stacked vertically
    # with a 10 pixel border around each
    sizer = wx.BoxSizer(wx.VERTICAL)
    sizer.Add(text, 0, wx.ALL, 10)
    sizer.Add(quitBtn, 0, wx.ALL, 10)
    sizer.Add(messBtn, 0, wx.ALL, 10)
    panel.SetSizer(sizer)
    panel.Layout()
  def OnQuitButton(self, evt):
    # event handler for the Quit button click or Exit menu item
    print "See you later alligator! (goes to stdout window)"
    wx.Sleep(1)  # 1 second to look at message
    self.Close()
  def OnMessButton(self, evt):
    # event handler for the Message button click
    self.SetStatusText('101 Different Ways to Spell "Spam"')
class wxPyApp(wx.App):
  def OnInit(self):
    # set the title too
    frame = Frame1(None, "wxPython GUI 2")
    self.SetTopWindow(frame)
    frame.Show(True)
    return True
# get it going ...
app = wxPyApp(redirect=True)
app.MainLoop()

希望本文所述對大家的Python程序設計有所幫助。

相關文章

  • Python實現的直接插入排序算法示例

    Python實現的直接插入排序算法示例

    這篇文章主要介紹了Python實現的直接插入排序算法,結合實例形式分析了Python直接插入排序算法的定義與使用相關操作技巧,代碼備有較為詳盡的注釋便于理解,需要的朋友可以參考下
    2018-04-04
  • python unittest單元測試的步驟分析

    python unittest單元測試的步驟分析

    在本篇文章里小編給大家整理了一篇關于python unittest單元測試的步驟,對此有興趣的朋友們可以跟著學習下。
    2021-08-08
  • 解決Python pandas plot輸出圖形中顯示中文亂碼問題

    解決Python pandas plot輸出圖形中顯示中文亂碼問題

    今天小編就為大家分享一篇解決Python pandas plot輸出圖形中顯示中文亂碼問題,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-12-12
  • Python計算回文數的方法

    Python計算回文數的方法

    這篇文章主要介紹了Python計算回文數的方法,實例分析了Python操作字符串的技巧,具有一定參考借鑒價值,需要的朋友可以參考下
    2015-03-03
  • python要安裝在哪個盤

    python要安裝在哪個盤

    在本篇文章里小編給大家分享的是一篇關于python必須裝在c盤嗎的知識點文章,有興趣的朋友們可以學習下。
    2020-06-06
  • 基于Python的身份證驗證識別和數據處理詳解

    基于Python的身份證驗證識別和數據處理詳解

    這篇文章主要介紹了基于Python的身份證驗證識別和數據處理,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-11-11
  • 今天 平安夜 Python 送你一頂圣誕帽 @微信官方

    今天 平安夜 Python 送你一頂圣誕帽 @微信官方

    昨晚我的朋友圈是這樣的:請給我一個圣誕帽@微信官方。好吧,看看python是怎么搞到圣誕帽的。下面跟隨小編一起看看吧
    2017-12-12
  • Python如何一行輸入多個數,并存入列表

    Python如何一行輸入多個數,并存入列表

    這篇文章主要介紹了Python如何一行輸入多個數,并存入列表,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-05-05
  • 使用python處理題庫表格并轉化為word形式的實現

    使用python處理題庫表格并轉化為word形式的實現

    這篇文章主要介紹了使用python處理題庫表格并轉化為word形式的實現,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-04-04
  • python中partial()基礎用法說明

    python中partial()基礎用法說明

    這篇文章主要給大家介紹了關于python中partial()基礎用法的相關資料,文中通過示例代碼介紹的非常詳細,對大家學習或者使用python具有一定的參考學習價值,需要的朋友們下面來一起看看吧
    2018-12-12

最新評論

十堰市| 通海县| 东山县| 集安市| 宕昌县| 乌拉特前旗| 扎赉特旗| 新丰县| 丁青县| 昆明市| 鹤山市| 浮山县| 香河县| 大埔县| 成安县| 临澧县| 南康市| 施秉县| 三穗县| 巴马| 泸水县| 南宁市| 乌海市| 古交市| 涟源市| 曲周县| 新巴尔虎右旗| 泰和县| 双牌县| 新郑市| 金乡县| 波密县| 乌海市| 庐江县| 吴江市| 高台县| 巴塘县| 沐川县| 常山县| 广汉市| 徐州市|