There are 1000’s of examples on the web but nothing that really answers my question. I have this code so far.
import tkinter as tk
from tkinter import ttk
def submit_callback(input_entry):
print("User entered : " + input_entry.get())
return None
# Creating tkinter window
window = tk.Tk()
window.title('GENERATOR')
window.geometry('500x550')
# label text for title
ttk.Label(window, text = "GENERATOR",
background = 'green', foreground ="white",
font = ("Times New Roman", 15)).grid(row = 0, column = 1)
# label
ttk.Label(window, text = "Select the ID :",
font = ("Times New Roman", 10)).grid(column = 0,
row = 5, padx = 10, pady = 25)
# Combobox creation
n = tk.StringVar()
monthchoosen = ttk.Combobox(window, width = 27, textvariable = n)
# Adding combobox drop down list
monthchoosen['values'] = ('1a', '2a', '3a','4a', '5a', '6a')
monthchoosen.grid(column = 1, row = 5)
monthchoosen.current()
ttk.Label(window, text = "DO YOU WANT TO OPEN THE FOLDER? :",
font = ("Times New Roman", 10)).grid(column = 0,
row = 15, padx = 10, pady = 25)
# Combobox creation
ns = tk.StringVar()
monthchoosen1 = ttk.Combobox(window, width = 27, textvariable = ns)
# Adding combobox drop down list
monthchoosen1['values'] = ('YES', 'NO')
monthchoosen1.grid(column = 1, row = 15)
monthchoosen1.current()
ttk.Label(window, text = "SELECT SPLIT SIZE :",
font = ("Times New Roman", 10)).grid(column = 0,
row = 20, padx = 10, pady = 25)
# Combobox creation
nss = tk.StringVar()
monthchoosen2 = ttk.Combobox(window, width = 27, textvariable = nss)
# Adding combobox drop down list
monthchoosen2['values'] = ('5','10','15','20','25','30','35','40','45' )
monthchoosen2.grid(column = 1, row = 20)
monthchoosen2.current()
input_label = tk.Label(window, text="Enter file name" ,font = ("Times New Roman", 10)).grid(column = 0,row = 30, padx = 10, pady = 25)
#input_label.place(column = 1, row = 30)
input_entry = tk.Entry(window, text="Enter some text" ,font = ("Times New Roman", 10)).grid(column = 1,row = 30, padx = 10, pady = 25)
submit_button = tk.Button(window, text = "Submit" , command = lambda: submit_callback(input_entry))
submit_button.place(x = 200, y = 490)
window.mainloop()
What I need it to do is run a script with input arguments passed to the script. As you can see I’ve tried to add combox boxes and text inputs. The idea would be to fill in the fields and press submit , this would run script generator.py , passing the 4 input arguments to the script.
Any further suggestions on how to complete this are most welcome.