文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Dynamic Widgets how to wxPython API

Dynamic Widgets how to wxPython API

时间:2010-04-02  来源:masonzhang

Dynamic Widgets

These widgets can be edited by users.

  • wx.Button

  • wx.BitmapButton

  • wx.Choice

  • wx.ComboBox

  • wx.CheckBox

  • wx.Grid

  • wx.ListBox

  • wx.RadioBox

  • wx.RadioButton

  • wx.ScrollBar

  • wx.SpinButton

  • wx.SpinCtrl

  • wx.Slider

  • wx.TextCtrl

  • wx.ToggleButton



秀出上面控件 下列程序可以实现  目的熟悉API 的用法


#-*- coding:cp936 -*-


import wx.grid


class MyFrame(wx.Frame):
    def __init__(self,parent,id,title):
        wx.Frame.__init__(self,parent,id,title)
        panel = wx.Panel(self,-1)
        box = wx.BoxSizer(wx.VERTICAL)
        box.Add(wx.StaticText(panel,-1,'静态框'),0,wx.ALIGN_CENTRE,10)
        box.Add(wx.TextCtrl(panel,-1),0,wx.ALIGN_CENTER,10)
        box.Add((-1,5))
        box.Add(wx.Button(panel,-1,'this is a demo '),0,wx.ALIGN_CENTER,10)
        box.Add(wx.BitmapButton(panel,-1,wx.Bitmap(r'd:\icon\media-skip-forward.png')),0,wx.EXPAND,1)
        box.Add(wx.Choice(panel,-1,),0,wx.ALIGN_BOTTOM,10)
        box.Add(wx.ComboBox(panel,-1),0,wx.ALIGN_BOTTOM,10)
        box.Add(wx.CheckBox(panel,-1,'check?'),0,wx.ALIGN_BOTTOM,10)
        g= wx.grid.Grid(panel,-1)
        g.CreateGrid(2,2)
        box.Add(g,0,wx.EXPAND,10)
        box.Add(wx.ListBox(panel,-1),0,wx.EXPAND,5)
        sampleList = ['zero', 'one', 'two', 'three', 'four', 'five','six', 'seven', 'eight']
        g= wx.RadioBox(panel, -1, "A Radio Box",(1,1), wx.DefaultSize,sampleList, 2, wx.RA_SPECIFY_COLS)
        box.Add(g,1,wx.EXPAND)
        box.Add(wx.RadioButton(panel,-1,'radiobutton'))
        box.Add(wx.StaticLine(panel,-1),0,wx.EXPAND)
        box.Add(wx.ScrollBar(panel,-1),0,wx.EXPAND)
        box.Add(wx.SpinCtrl(panel,-1,'spinbutton',(30, 20), (80, -1)),0,wx.EXPAND,5)
        box.Add(wx.SpinButton(panel,-1),0,wx.EXPAND,5)
        slider = wx.Slider(panel, 100, 25, 1, 100, pos=(10, 10),size=(250, -1),style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS )
        slider.SetTickFreq(5, 1)
        box.Add(slider,0,wx.EXPAND)
        box.Add(wx.ToggleButton(panel,-1,'toggle'))
        box.Add(wx.Button(panel,-1,'Normal button'))
        
        panel.SetSizer(box)
        
        self.SetClientSize(panel.GetBestSize())
        self.Center()
        self.Show()
        
app = wx.PySimpleApp()

frame = wx.Frame(None ,-1 ,'Masonzhang')

frame.SetTitle('小小思')

frame.SetToolTip(wx.ToolTip('不要问我从哪里来!'))

frame.SetCursor(wx.StockCursor(wx.CURSOR_QUESTION_ARROW))
frame.SetIcon(wx.Icon(r'd:\home\20.ico', wx.BITMAP_TYPE_ICO))



frame.Show()
#frame.Destroy()
myframe = MyFrame(None,-1,'masonzhang')
app.SetTopWindow(myframe)
app.MainLoop()





排行榜 更多 +
找茬脑洞的世界安卓版

找茬脑洞的世界安卓版

休闲益智 下载
滑板英雄跑酷2手游

滑板英雄跑酷2手游

休闲益智 下载
披萨对对看下载

披萨对对看下载

休闲益智 下载