I am trying to run a python script(loop to listen to incoming email) with tkinter GUI, but the problem is when I executed the GUI my script is also run with the GUI even the button not pushed yet pls any help also if possible a little help with a button to stop my script, already thanks
the script used https://stackoverflow.com/a/59538076/13780184 my gui code:
import tkinter as tk
from tkinter import ttk
from tkinter import *
from itertools import chain
import os
# this is the function called when the button is clicked
def btnClickFunction():
print('clicked')
#the script is pasted here
# this is the function called when the button is clicked
def btnClickFunction():
print('clicked2')
# this is a function to get the user input from the text input box
def getInputBoxValue():
userInput = tInput.get()
return userInput
root = Tk()
# This is the section of code which creates the main window
root.geometry('618x400')
root.configure(background='#FFEFDB')
root.title('Hello, I\'m the main window')
# This is the section of code which creates a button
Button(root, text='Button text!', bg='#FFEFDB', font=('arial', 12, 'normal'), command=btnClickFunction).place(x=31, y=67)
# This is the section of code which creates the a label
Label(root, text='this is a label', bg='#FFEFDB', font=('arial', 12, 'normal')).place(x=43, y=151)
# This is the section of code which creates a button
Button(root, text='Button text!2', bg='#FFEFDB', font=('arial', 12, 'normal'), command=btnClickFunction).place(x=203, y=73)
# This is the section of code which creates a text input box
tInput=Entry(root)
tInput.place(x=251, y=200)
root.mainloop()