I am trying to create a simple textbox using tkinter. Below is the code I am trying to use.
import tkinter as tk
from tkinter import simpledialog
root = tk.Tk() # Create an instance of tkinter
start_date = simpledialog.askstring(title = "Test Title",
prompt = "Entire Start Date in MM/DD/YYYY format:")
Below is the output I am getting as expected.
My question is, how do I populate a default value in the empty slot by default, as shown below?
In R, I can easily do this using the below command.
start_date <- winDialogString("Entire Start Date in MM/DD/YYYY format:", "01/31/2018")
Have you read this? You can provide initialvalue
as option like
simpledialog.askstring(title = "Test Title", prompt = "Entire Start Date in MM/DD/YYYY format:", initialvalue="whateveryouwant")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With