from tkinter import filedialog, font
from tkinter import *
from tkinter import ttk
root = Tk()
root.geometry("300x100")
root.title("SRT")
root.resizable(False, False)
frame = Frame(root)
frame.grid(column=1, row =0)
def open():
b.destroy()
filename1 = filedialog.askopenfilename(filetypes=[("SRT files(*.srt)", "*.srt")],initialdir = "/", title = "Select file")
root.geometry("775x300")
k=Label(frame,text="SELECTED SUBTITLE",font=("Times New Roman", 15)).grid(column=3, row =0)
y=Label(frame,text=filename1,font=("Times New Roman", 12)).grid(column=3, row =1)
seconds=Label(root, font=("Times New Roman", 15),text="Seconds").grid(column=2,row=2)
minutes=Label(root, font=("Times New Roman", 15),text="Minutes").grid(column=0,row=2,ipadx=20)
minuteselect = StringVar()
minutes = ttk.Combobox(root, textvariable=minuteselect)
minutes['values']=tuple([i for i in range(1,61)])
minutes['state'] = 'readonly'
minutes.grid(column=0,row=4,padx=10)
secondselect = StringVar()
seconds = ttk.Combobox(root, textvariable=secondselect)
seconds['values']=tuple([i for i in range(1,61)])
seconds['state'] = 'readonly'
seconds.grid(column=2,row=4)
plus =Button(root,text="DECREASE", width='10', height='1').place(x=400,y=150)
minus =Button(root,text="INCREASE", width='10', height='1').place(x=280,y=150)
b =Button(frame,text="Select The Subtitle", width='30', height='1',command=open)
b.grid(row=1, column=1,padx=41,pady=30)
b.rowconfigure(1, weight=1)
b.columnconfigure(1, weight=1)
root.mainloop()
I'm trying to build an app which synchronizes an srt file and creates a new file after syncing the time of the subtitle file from the users input. I am currently stuck at how to retrieve the data from the two Combobox and and process the file according to the input from the user. In my code i have tried to input a file directly and opened a second window which gives the options minutes and seconds using 2 comboboxes and two buttons INCREASE and DECREASE, If the increase is clicked it would redirect to a function which gets the input from the combobox and increases the time in the srt file using the fuctions provided py the module pysrt and vice versa if i click decrease. I am currently stuck at how to get the two inputs: (1)time in seconds and minutes and(2) Increase or Decrease Button and call the functions accordingly.