On Wed, Mar 16, 2011 at 4:56 PM, Hugo Parente Lima <[email protected]> wrote: > On Wednesday 16 March 2011 08:27:59 Markus Hubig wrote: >> Hi @all! >> >> I'm new to to GUI programming and this is surely a simple newbie >> question ;-) >> I've created a small GUI with just one Button and a progessbar. If one >> presses the Button a QStateMachine is created and started and performs >> a >> rather long running process. >> >> Now, what I wanna do is to update a progessbar every time I'm entering >> a new State. The Problem is that I'm running thru my StateMachine but >> the progessbar is updated only _after_ the QStateMachine is finished! >> >> So what I'm missing here? > > You need to give Qt a chance to process the events, when you call > machine.start() the machine starts, change states and until it finishes Qt > doesn't process any event, so the GUI isn't updated. > > There's two possibilities to fix this: > > - Put your state machine code into a separated thread. > - Call QCoreApplication.processEvents() on each slot used by your > QStateMachine.
Although, you need to take care that processEvents() will never be called while actually processing events. _______________________________________________ PySide mailing list [email protected] http://lists.pyside.org/listinfo/pyside
