Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6146993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:02:24+00:00 2026-05-23T19:02:24+00:00

Specs: Python2.7.1 Tkinter (Tk version 8.5) Windows7 IDLE 2.7.1 I’m coding a program that

  • 0

Specs:
Python2.7.1
Tkinter (Tk version 8.5)
Windows7
IDLE 2.7.1

I’m coding a program that ‘spawns’ two windows, withdraws both, destroys one and then deiconifies the other (which then enters a mainloop).
This arrangement is interfering with a Checkbutton on the remaining window.

eg:

temp = Tk()
temp.withdraw()

root = Tk()
root.withdraw()
temp.destroy()

root.mainloop()

(It seems unusual, but it is set up this way so that the ‘temp’ window will display the problems that arose, during building of the root window).

However,
it seems that as soon as a single program deals with two Tkinter windows,
functionality of a Checkbutton (in root) goes out the window.

def ClickAButton():
    print Toggle.get()
Toggle = IntVar()
Checkbutton(root, text = "Me is broke", variable = Toggle).pack()
ClickAButton

Toggle.get() should return a 1 if the Checkbutton is ticked, otherwise a 0.
However, since adding the new window, Toggle.get always returns a 0.

(I’ve tried reformatting code {this brings up strange erros of it’s own},
renaming variables, etc.
The Checkbutton works just fine without the ‘temp’ window.

The ‘temp’ window is destroyed before the Checkbutton is even assigned, packed,
or ‘root’ even enters a mainloop!)

Entire eg:

temp = Tk()
temp.withdraw()
root = Tk()
root.withdraw()
if 'certain condition':
    root.destroy()
    temp.deiconify()
    temp.mainloop()
else:
    temp.destroy() 
    Toggle = IntVar()
    Checkbutton(root, text = "Why I only return 0?", variable = Toggle).pack()
    root.deiconify()
    root.mainloop()

For some reason,
the Checkbutton is always returns 0, even when checked.
I suspect it’s a multi-threading issue with Tkinter.

Is there anything at all I can do here?
(The actual coding is HUGE. I’m not eager to switch it all to another GUI module)
😐

Greatly appreciated!

(I only started programming the start of this year.
Please forgive me if I’ve made some horribly noobish mistake!)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:02:24+00:00Added an answer on May 23, 2026 at 7:02 pm

    Tkinter isn’t designed to have two root windows. I’m amazed your code works at all. This has nothing to do with multi-threading — Tkinter is single threaded and you don’t appear to be creating any new threads (though if you are, that might contribute to the problem)/

    You need to create a single root window with a single mainloop. If you need another window, create a Toplevel window — that’s precisely what that widget is for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here are the specs that I'm trying to implement in a nutshell: 1) Some
What do you recommend as minimum specs for a Windows laptop running Vista, an
I have a number of view specs that need certain methods to be stubbed.
A git tool that meets the specs below is needed. Does one already exist?
Looking at the C# and VB.NET language specs I think it says that the
What I need is a tkinter window that is transparent, but with a image
According to HTML specs, the select tag in HTML doesn't have a readonly attribute,
When should I use specs for Rails application and when Cucumber (former rspec-stories)? I
I've never written functional specs, I prefer to jump into the code and design
I'm trying to put some specs around a new rails 3 project I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.