1

My program stops working after successfully running the two exes. here is the code:

from tkinter import *
import os
root = Tk()
root.geometry('350x150')
root.title("hurler")
photo = PhotoImage(file = "Logo_Image.png")
root.iconphoto(False, photo)

entry_text = Label(text = "Number of posts you wish to automate (between 1-12) * ")

entry_text.place(x = 15, y = 10)

num = StringVar()

time_entry = Entry(textvariable = num, width = "10")

time_entry.place(x = 15, y = 40)

def action():
    global num
    num = num.get()
    if num == '1':
        os.startfile('.\\hurl\\hurl.exe')
#        exit()
    if num == '2':
        os.startfile('.\\hurl\\hurl.exe')
        os.startfile('.\\hurl2\\hurl.exe')
#        exit()
    num = StringVar()

register = Button(root,text = "Make", width = "10", height = "2", command = action, bg = "lightblue")
register.place(x = 15, y = 70)

root.mainloop()

hurl takes in text entries and then runs a web driver exe after pressing the Post button. Heres a sample block from code from hurl:

from tkinter import *
import os
from time import sleep
root = Tk()
root.geometry('600x600')
root.title("hurl")
photo = PhotoImage(file = "Logo_Image.png")
root.iconphoto(False, photo)

def save_post():
    emailE = email_in.get()
    file1 = open ("user.txt", "w") 
    file1.write(emailE)
    file1.close()
    passE = pass_in.get()
    file2 = open ('pass.txt', 'w')
    file2.write(passE)
    file2.close()

entry1_text = Label(text = "Email * ",)
entry2_text = Label(text = "Password * ",)

entry1_text.place(x = 15, y = 70)
entry2_text.place(x = 15, y = 130)

email_in = StringVar()
pass_in = StringVar()

email_entry = Entry(textvariable = email_in, width = "30")
pass_entry = Entry(textvariable = pass_in, width = "30")

def app():
     os.system(".\Auto_Post_With_Photo.exe")

def everything():
    save_post()
    app()

register = Button(root,text = "Post", width = "10", height = "2", command = everything, bg = "lightblue")
register.place(x = 15, y = 380)

root.mainloop()

I'm hoping I don't need to show the last program to get an answer to the issue. The Issue I'm having is that the program runs perfectly until the button is pressed, and then the hurls exes crash.

But if I click on the two hurl.exe with my mouse and not this 3rd program pressing the post button won't crash.

Any ideas to fix this issue? Also, it's not due to the 'exit()s', it does the same thing with or without them. :)

Matthew
  • 27
  • 6

0 Answers0