views:

74

answers:

1

I have an existing python script and I want to wrap it in a GUI. Since I already have tkinter installed I would like to use it if possible. At the moment my script has many places where it asks for user input using raw_input(). I would like to replace these with either a modal pop-up asking for user input or (preferably) an Entry object which responds to the enter key.

+2  A: 

UI toolkits usually have an event-driven model where the main loop is in the toolkit itself. This is probably different from your current synchronous, interactive model (where the program just pauses while waiting for input)

The best would be to try to refactor your program and factor-out the view part (look up the model-view-control design pattern). After that, it should be easy to replace your console oriented view with an tkInter based one.

(that's as specific as I can get without a concrete question)

Ivo van der Wijk