Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #12410
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'threads,': 0.07; 'received:188.220': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'def': 0.15; '#call': 0.16; 'evt': 0.16; 'performed.': 0.16; 'self,': 0.16; 'threading': 0.16; 'wrote': 0.20; 'this?': 0.21; "doesn't": 0.22; 'subject:change': 0.24; 'url:wiki': 0.25; 'function': 0.27; 'import': 0.28; 'email name:': 0.30; 'installation': 0.30; 'does': 0.32; 'to:addr:python- list': 0.33; 'header:User-Agent:1': 0.34; 'like:': 0.34; 'header:X -Complaints-To:1': 0.35; 'doing': 0.36; 'using': 0.37; 'something': 0.37; 'received:org': 0.38; 'url:org': 0.38; 'subject:: ': 0.39; 'suggestions': 0.39; 'to:addr:python.org': 0.39; 'your': 0.61; 'target': 0.61; 'back': 0.62; 'here': 0.65; 'received:188': 0.68; 'become': 0.71; 'subject:!!!': 0.76; 'skip:n 40': 0.84; 'received:bethere.co.uk': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Rob Williscroft <rtw@rtw.me.uk> |
| Subject | Re: Button Label change on EVT_BUTTON in wxpython!!! |
| Date | Mon, 29 Aug 2011 17:46:49 +0000 (UTC) |
| References | <aa1212bb-35e5-4bf9-b8ad-7a3c083749c2@x2g2000yql.googlegroups.com> |
| X-Gmane-NNTP-Posting-Host | 188-220-43-229.zone11.bethere.co.uk |
| User-Agent | Xnews/5.04.25 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.549.1314640033.27778.python-list@python.org> (permalink) |
| Lines | 47 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1314640033 news.xs4all.nl 2494 [2001:888:2000:d::a6]:48306 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:12410 |
Show key headers only | View raw
Ven wrote in news:aa1212bb-35e5-4bf9-b8ad-7a3c083749c2
@x2g2000yql.googlegroups.com in gmane.comp.python.general:
> So, here is what I did/want:
>
> self.run_button=wx.Button(self.panel,ID_RUN_BUTTON,label='Install')
> self.Bind(wx.EVT_BUTTON, self.OnRun,id=ID_RUN_BUTTON)
>
> def OnRun(self,evt):
> self.run_button.SetLabel('Installing..')
> #call a function that does the installation task
> installation_task()
> #After task completion, set the button label back to "Install"
> self.run_button.SetLabel('Install')
>
> When I try doing this, it doesn't set the label to "Installing" while
> the task is being performed. Any suggestions how do I achieve this?
>
http://wiki.wxpython.org/CallAfter
Using this your OnRun will become somthing like:
def OnRun( self, evt ):
def after():
installation_task()
self.run_button.SetLabel('Install')
self.run_button.SetLabel('Installing..')
wx.Callafter( after )
However if installation_task takes a long time you will need to use
threads, something like (untested):
def OnRun( self, evt ):
def after():
self.run_button.SetLabel('Install')
def task():
installation_task()
wx.Callafter( after )
self.run_button.SetLabel('Installing..')
import threading
threading.Thread( target = task ).start()
Rob.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Button Label change on EVT_BUTTON in wxpython!!! Ven <praveen.venkata@gmail.com> - 2011-08-28 18:30 -0700 Re: Button Label change on EVT_BUTTON in wxpython!!! Philip Semanchuk <philip@semanchuk.com> - 2011-08-28 22:34 -0400 Re: Button Label change on EVT_BUTTON in wxpython!!! Rob Williscroft <rtw@rtw.me.uk> - 2011-08-29 17:46 +0000
csiph-web