Python Forum
Tkinter Python: How to make sure tkSimpleDialog takes in No value entered
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tkinter Python: How to make sure tkSimpleDialog takes in No value entered
#1
I am making a GUI in Python 2.7 and I am using Tkinter. Right now what this simple dialog box is doing is it is taking the answer that we are typing except for '', i.e if I erase with my keyboard delete key whatever I entered into the dialog box and click close and reopen that dialog box it still remembers the text I deleted. I want it to enter '' so basically nothing after I delete everything.
answer = tkSimpleDialog.askstring("Input", "Enter the value:", parent = top, initialvalue=Address[n])
Reply
#2
python 2.7 was obsoleted January 1, 2020.
Why are you trying to use it?
Reply
#3
By close, you're referring to the window close "x" on the dialog box?

If so, what do you mean by "reopen" the dialog? How are you reopening it except by making another askstring() call?
Reply
#4
When it is created you are using the option initialvalue=Address[n] so whatever Address[n] is will appear.
Either remove the option so the defualt empty string appears or change the value of Address[n] to answer
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  make widgets disappear from tkinter jacksfrustration 12 1,123 Feb-06-2024, 03:58 PM
Last Post: deanhystad
  Why I am getting ModuleNotFoundError when I make an Exe file for tkinter GUI? pymn 0 1,648 Apr-01-2022, 05:36 PM
Last Post: pymn
  [Tkinter] It it possible to make a help file explorer with tkinter? Clunk_Head 0 1,981 Aug-07-2021, 06:02 PM
Last Post: Clunk_Head
  [Tkinter] tkinter.Menu – How to make text-variable? Sir 3 5,631 Mar-10-2021, 04:21 PM
Last Post: Sir
  How to make button text bold in Tkinter? scratchmyhead 2 12,038 May-16-2020, 02:53 AM
Last Post: scratchmyhead
  Make Label Text background (default color) transparent using tkinter in python barry76 1 23,751 Nov-28-2019, 10:19 AM
Last Post: Larz60+
  Tkinter - Make changes to graph and update it adriancovaci 0 6,593 Apr-08-2019, 09:02 AM
Last Post: adriancovaci
  Gtk.EntryCompletion, get all suggestions, not only beginning with entered string. TimeMen 0 2,047 Oct-08-2018, 06:44 PM
Last Post: TimeMen
  [Tkinter] Multiple frames with tkinter - How to make them run on fullscreen mode eabs86 3 18,256 Sep-20-2018, 01:27 AM
Last Post: eabs86
  [Tkinter] Entry widget : unable to get the text entered dlemper 2 18,221 Oct-11-2016, 12:32 AM
Last Post: dlemper

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020