On 2014-03-04 01:33, Rolando wrote:
> I have a GUI with a bunch of cells which is my "View" in the MVC
> design. The user enters some information in the view and I pass this
> on to the model so that using the information entered by the user
> it(model) can do some processing.
>
> I have coded up my model as a state machine. Wherein, once a function
> is complete it switches to the next state and so on.
>
> I want to know how do I save the program state between restarts.
> Basically, I'm trying to handle a scenario wherein if someone closes
> the program. The next time someone starts it up, it should start from
> where it left off (both the view and model)
>
When the user closes the window (you don't say what you're using for
the GUI, but there should be a way of detecting when window closes),
save the necessary info to a file using, say, the 'json' module. You
can then reload the info from the file when the program is restarted.

> Also, I want to setup a poll method where once in a while I can poll
> each cell to know the state it is in. How do I do this? I don't want
> my GUI to hang when I'm doing anything. It will be great if someone
> could help. Thanks!
>
Can the model run continuously? If so, you should run it in its own
(background) thread and the GUI in the main thread and communicate
with the model's thread via, say, a queue (for that use the 'queue'
module).
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to