[Tutor] Python tkinter. Opening another script from main window stop main window from functioning. Looking for Help

Steven D'Aprano steve at pearwood.info
Sun Apr 26 13:30:26 CEST 2015


On Sat, Apr 25, 2015 at 11:23:44PM -0400, Spencer For Friends wrote:
> Hi all. I'm new to Python and I'm trying my best to learn, but I'm really
> struggling with some problems.

You've picked a *very* hard problem to solve. I can tell you what's 
wrong, but I can't tell you how to fix it. I know it can be fixed, but 
I've never had to do it before.

[Thinking aloud... Maybe the subprocess module? ... ]

[snip code]

> def callback():
>     execfile("test.py")

Here is your problem: execfile will run a Python program, but it 
has to wait for that program to finish before it can continue. So your 
callback is waiting for the test.py program to finish, which I guess 
means closing its windows.

It you want to have test.py run independently of this window, you cannot 
use execfile.

Sorry I can't solve your problem, but at least you now understand it.


-- 
Steve


More information about the Tutor mailing list