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 7832529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:16:02+00:00 2026-06-02T12:16:02+00:00

I was trying out a python code example at Rosetta Code – a programming

  • 0

I was trying out a python code example at Rosetta Code – a programming chrestomathy site, where solutions to the same task are presented in as many different programming languages as possible. For this task, the goal is to input a string and the integer 75000, from graphical user interface. The code is shown below:

import tkSimpleDialog

number = tkSimpleDialog.askinteger("Integer", "Enter a Number")
string = tkSimpleDialog.askstring("String", "Enter a String")

However, when I try to run the code, I get the following error:

Traceback (most recent call last):
  File "C:\Users\vix\Documents\.cache\GUIexample.py", line 3, in <module>
    number = tkSimpleDialog.askinteger("Integer", "Enter a Number")
  File "C:\Python27\lib\lib-tk\tkSimpleDialog.py", line 262, in askinteger
    d = _QueryInteger(title, prompt, **kw)
  File "C:\Python27\lib\lib-tk\tkSimpleDialog.py", line 189, in __init__
    Dialog.__init__(self, parent, title)
  File "C:\Python27\lib\lib-tk\tkSimpleDialog.py", line 53, in __init__
    if parent.winfo_viewable():
AttributeError: 'NoneType' object has no attribute 'winfo_viewable'

Where could the problem be?

Thanks

  • 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-06-02T12:16:04+00:00Added an answer on June 2, 2026 at 12:16 pm

    The error message is telling you that the dialog needs a parent window.

    With Python 2.x, you create the root window with:

    import tkinter
    from tkinter import simpledialog
    root = tkinter.Tk()
    

    To hide the root window if you don’t want it, use:

    root.withdraw()
    

    See the Python Tkinter Docs for more info.

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

Sidebar

Related Questions

I am trying to figure out the difference between Google's GData API ( http://code.google.com/p/gdata-python-client/
I was trying out an experiment with Python, trying to find out how many
I'm trying to figure out Python lambdas. Is lambda one of those "interesting" language
I have downloaded and installed python-poppler-qt4 and I am now trying out a simple
I'm looking for a good python library to manipulate subversion repositories. I'm trying out
I ran across the caret operator in python today and trying it out, I
I'm trying to figure out how to compile Python modules in C ( http://docs.python.org/extending/extending.html
I'm trying to figure out a 'simple' dictionary/database with Python, which will retrieve a
I'm trying to figure out how to parse a VCard to a Python dictionary
I am very new to Python, and trying to figure out how to create

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.