您的位置:首页 > 编程语言 > Python开发

wxPython:进度条Gauge介绍

2013-03-16 00:00 141 查看
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import wx

'''
Function:绘图
Input:NONE
Output: NONE
author: socrates
blog:http://www.cnblogs.com/dyx1024/
date:2012-07-22
'''

class GuageFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, 'Gauge Example', size = (600, 300))
panel = wx.Panel(self, -1)
panel.SetBackgroundColour("white")
self.count = 0
self.gauge = wx.Gauge(panel, -1, 100, (100, 60), (250, 25), style = wx.GA_PROGRESSBAR)
self.gauge.SetBezelFace(3)
self.gauge.SetShadowWidth(3)
self.Bind(wx.EVT_IDLE, self.OnIdle)

def OnIdle(self, event):
self.count = self.count + 1
if self.count >= 80:
self.count = 0
self.gauge.SetValue(self.count)

if __name__ == '__main__':
app = wx.PySimpleApp()
frame = GuageFrame()
frame.Show()
app.MainLoop()

测试:



知识点介绍:
原型:
bool Create(wxWindow* parent, wxWindowID id, int range, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxGA_HORIZONTAL, const wxValidator& validator = wxDefaultValidator, const wxString& name = "gauge")
方法:

wxGauge::wxGauge

wxGauge::~wxGauge

wxGauge::Create

wxGauge::GetBezelFace

wxGauge::GetRange

wxGauge::GetShadowWidth

wxGauge::GetValue

wxGauge::IsVertical

wxGauge::SetBezelFace

wxGauge::SetRange

wxGauge::SetShadowWidth

wxGauge::SetValue

wxGauge::Pulse
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: