Sicong: Why are you so sad?

Small two: Alas… Don’t say that, onion shao, is not the home of the use of money too much, the boss gave too little, fast can not open the pot…

Cecong: That’s not easy. Write a letter of resignation to your boss and ask him to pay the balance to you. You can report to Dhawan as soon as you finish your work. However, your boss may not agree easily, so you need to figure out how to deal with it.

Xiao 2: It’s impossible to disagree. Let me write a resignation letter in Python and ask my boss to agree in minutes.

Get a sneak peek.

No matter the boss points to close or point to disagree, can not close the window, finally only reluctantly agreed…

The main functions of a resignation letter include: agree, disagree and close the window.

  • Agree: Click agree pop-up prompt box, click the button on the prompt box to close the entire window
  • Disagree: Click disagree, disagree button move, click one move at a time…
  • Close the window: ClickX“Close the window, pop-up humiliate prompt box

Let’s look at the code implementation.

Agree to the code implementation as follows:

def agree() :
    win = tk.Toplevel(window)
    win.geometry("500x150+{}+{}".
                 format(int((screenwidth - width) / 2),
                        int((screenheight - height) / 2)))
    win.title("Quit")
    label = tk.Label(win, text="Your rattail juice.", font=("Chinese Script".20))
    label.pack()
    btn = tk.Button(win, text="Get out of here.", width=6, height=1, command=window.destroy)
    btn.pack()
Copy the code

Do not agree with the code implementation as follows:

def disagree():
    B2.place_forget()
    B2.place(x=random.randint(100, 500), y=random.randint(100, 500))
Copy the code

The code for closing the window is as follows:

def closeWindow() :
    messagebox.showinfo(title="I can't shut it down without consent.", message="Can't turn it off, huh?")
Copy the code

The source code is retrieved from a resume in Python.