We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,439 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

wxpython filecopy progress bar

Friends, kindly help me how to update the progress bar in WX Widgets python while copying folder in windows... i tried searching a lot.. please do help me out..

Thanks in advance!
Ganesh R

2
Contributors
1
Reply
1 Week
Discussion Span
1 Year Ago
Last Updated
2
Views
ganeshrnet
Newbie Poster
5 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

For more check this out. http://www.wxpython.org/docs/api/wx.Gauge-class.html

class ProgressDialog(wx.Dialog):
"""
Shows a Progres Gauge while an operation is taking place. May be cancellable
which is possible when converting pdf/ps
"""
def __init__(self, gui, title, to_add=1, cancellable=False):
    """Defines a gauge and a timer which updates the gauge."""
    wx.Dialog.__init__(self, gui, title=title,
                      style=wx.CAPTION)
    self.gui = gui
    self.count = 0
    self.to_add = to_add
    self.timer = wx.Timer(self)
    self.gauge = wx.Gauge(self, range=100, size=(180, 30))
    sizer = wx.BoxSizer(wx.VERTICAL)
    sizer.Add(self.gauge, 0, wx.ALL, 10)

    if cancellable:
        cancel = wx.Button(self, wx.ID_CANCEL, _("&Cancel"))
        cancel.SetDefault()
        cancel.Bind(wx.EVT_BUTTON, self.on_cancel)
        btnSizer = wx.StdDialogButtonSizer()
        btnSizer.AddButton(cancel)
        btnSizer.Realize()
        sizer.Add(btnSizer, 0, wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, 10)

    self.SetSizer(sizer)
    sizer.Fit(self)
    self.SetFocus()

    self.Bind(wx.EVT_TIMER, self.on_timer, self.timer)
    self.timer.Start(30)


def on_timer(self, event):
    """Increases the gauge's progress."""
    self.count += self.to_add
    self.gauge.SetValue(self.count)
    if self.count > 100:
        self.count = 0


def on_cancel(self, event):
    """Cancels the conversion process"""
    # do whatever
bishisht
Newbie Poster
6 posts since Nov 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0555 seconds using 2.72MB