欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

本文實例講述了基于wxpython實現(xiàn)的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程序設計有所幫助。

相關文章

  • Python3實現(xiàn)連接SQLite數(shù)據(jù)庫的方法

    Python3實現(xiàn)連接SQLite數(shù)據(jù)庫的方法

    這篇文章主要介紹了Python3實現(xiàn)連接SQLite數(shù)據(jù)庫的方法,在Python數(shù)據(jù)庫編程中有著廣泛的應用,需要的朋友可以參考下
    2014-08-08
  • PyTorch之怎樣選擇合適的優(yōu)化器和損失函數(shù)

    PyTorch之怎樣選擇合適的優(yōu)化器和損失函數(shù)

    這篇文章主要介紹了PyTorch怎樣選擇合適的優(yōu)化器和損失函數(shù)問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-02-02
  • Python的Pillow庫進行圖像文件處理(圖文詳解)

    Python的Pillow庫進行圖像文件處理(圖文詳解)

    本文詳解的講解了使用Pillow庫進行圖片的簡單處理,使用PyCharm開發(fā)Python的詳細過程和各種第三方庫的安裝與使用。感興趣的可以了解一下
    2021-11-11
  • 詳解Python的基礎語法和變量操作

    詳解Python的基礎語法和變量操作

    這篇文章主要詳細介紹了Python的基礎語法和變量操作,對剛剛學習python的小伙伴非常友好,對我們的學習有一定的幫助,需要的朋友可以參考下
    2023-06-06
  • 基于python if 判斷選擇結(jié)構的實例詳解

    基于python if 判斷選擇結(jié)構的實例詳解

    代碼執(zhí)行結(jié)構為順序結(jié)構、選擇結(jié)構、循環(huán)結(jié)構。這篇文章主要介紹了python if 判斷選擇結(jié)構的相關知識,非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下
    2019-05-05
  • python中的生成器、迭代器、裝飾器詳解

    python中的生成器、迭代器、裝飾器詳解

    本文詳細講解了python中的生成器、迭代器、裝飾器,文中通過示例代碼介紹的非常詳細。對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-07-07
  • 一文詳解Python中的時間和日期處理

    一文詳解Python中的時間和日期處理

    在Python開發(fā)中,我們經(jīng)常需要處理日期和時間,Python提供了一些內(nèi)置模塊,如datetime、time和calendar,這些模塊讓我們能夠輕松地獲取、操作和格式化日期和時間,本文將介紹如何在Python中使用這些模塊進行日期和時間的處理
    2023-06-06
  • python3 http提交json參數(shù)并獲取返回值的方法

    python3 http提交json參數(shù)并獲取返回值的方法

    今天小編就為大家分享一篇python3 http提交json參數(shù)并獲取返回值的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-12-12
  • Python中如何創(chuàng)建和運行異步任務詳解

    Python中如何創(chuàng)建和運行異步任務詳解

    這篇文章主要為大家介紹了Python中如何創(chuàng)建和運行異步任務詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-03-03
  • Python matplotlib畫圖與中文設置操作實例分析

    Python matplotlib畫圖與中文設置操作實例分析

    這篇文章主要介紹了Python matplotlib畫圖與中文設置操作,結(jié)合實例形式分析了Python使用matplotlib進行圖形繪制及中文設置相關操作技巧,需要的朋友可以參考下
    2019-04-04

最新評論