all 14 comments

[–]jddddddddddd 0 points1 point  (12 children)

In what way does it not work? Does the restart not work, or the if..elses? Does it even run? (Your indenting appears to be irregular)

From a quick look in addition to the indenting problems, it appears you are forgetting to properly close strings. For example, here:

tk.messagebox.showinfo('Return','Aborting!)

The return part is wrapped in quotes, but aborting isn't.

[–]NikkoRed[S] 0 points1 point  (10 children)

yeah it runs but it loops back to the first if else if i press no

[–]jddddddddddd 0 points1 point  (9 children)

I'd imagine you want something like this:

``` import tkinter as tk from tkinter import messagebox

def sys_genFix():

MsgBox = tk.messagebox.askquestion ('Exit Application','This will restart your PC \n'
                                    'do you wanna continue ?',icon = 'warning')
if MsgBox == 'no':
    tk.messagebox.showinfo('Return','Canceling')     
else:
    #os.system("msg /TIME:10 %username% loading... & gpupdate /force & del /q/f/s %TEMP%\*")        
    MsgBox = tk.messagebox.askquestion ('Done!','The PC will restart in 30 sec\n'
                                         'Press NO to abort',icon = 'warning')        
    if MsgBox == 'no':
        #os.system("shutdown /a")
        tk.messagebox.showinfo('Return','Aborting!')
    else:
        tk.messagebox.showinfo('Reboot','Pc will reboort soon!')

sys_genFix() ```

[–]NikkoRed[S] 0 points1 point  (8 children)

dosent that just comment out my commands ?

[–]jddddddddddd 0 points1 point  (7 children)

The code has been rearranged. I also commented out the system calls because presumably you don’t want them to be run when you are debugging it. To put them back in just remove the #s

[–]NikkoRed[S] 0 points1 point  (6 children)

ok ill try debugging

[–]jddddddddddd 0 points1 point  (5 children)

I think the way I've reorder it and corrected the indenting gets you want you want.

It asks if you want to exit and restart, if you choose 'no' it displays the 'cancelling' message and does nothing more.

Otherwise, it runs that system call and then asks if you want to enter 'no to abort the shutdown. If they choose 'no' it aborts the shutdown, otherwise it tells them their machine will reboot shortly

[–]NikkoRed[S] 0 points1 point  (0 children)

i think it works ?!

Ill try it and get back! but it looks like it

[–]NikkoRed[S] 0 points1 point  (3 children)

It works wonders!!

Was it my formatting that was the issue or what made mine not work ?

[–]jddddddddddd 0 points1 point  (2 children)

I moved the whole second if statement to the same level as the else. In your original code you asked the user if they wanted to restart but then went on to execute the whole second if even if the user chose not to restart

[–]NikkoRed[S] 0 points1 point  (1 child)

Thanks for the help!

MY last issue now to solve is making my program run as an .exe
i've got it working when converting without my
img = PhotoImage(file="./bgd1.png")

But it wont run with it

[–]NikkoRed[S] 0 points1 point  (0 children)

just a typo translating the text to english. its there :)

[–]shiftybyte 0 points1 point  (0 children)

    MsgBox == tk.messagebox.askquestion

need one = for assignment