Silk Cong: Why is Xiao Er looking sad?
Xiao Er: Oh... Don't say it, there are few green onions, it's not that the family spends too much money, the boss gave too little, it is almost impossible to open the pot...
Silk Cong: It's not easy. Write a letter of resignation to your boss and ask him to settle the balance. You will report to Dawan as soon as you are done. But your boss may not agree easily, you have to figure out how to deal with it.
Xiao Er: It is impossible to disagree. Look at me writing a resignation letter in Python and let the boss agree in minutes.
See it soon.
The boss couldn’t close the window no matter if he clicked close or disagree, he had no choice but to agree in the end...
The main functions of the resignation letter include: agree, disagree, and close the window.
- Agree: Click on agree to pop up a prompt box, click the button on the prompt box to close the entire window
- Disagree: Click disagree, disagree button to move, click once to move once...
- Close the window: Click
X
to close the window, and a humiliation prompt box will pop up
Let's take a look at the specific code implementation.
The agreed code implementation is as follows:
def agree():
win = tk.Toplevel(window)
win.geometry("500x150+{}+{}".
format(int((screenwidth - width) / 2),
int((screenheight - height) / 2)))
win.title("辞职")
label = tk.Label(win, text="您耗子尾汁", font=("华文行楷", 20))
label.pack()
btn = tk.Button(win, text="滚出去", width=6, height=1, command=window.destroy)
btn.pack()
Disagree that the code is implemented as follows:
def disagree():
B2.place_forget()
B2.place(x=random.randint(100, 500), y=random.randint(100, 500))
The code for closing the window is implemented as follows:
def closeWindow():
messagebox.showinfo(title="不同意关不掉", message="关不掉吧,呵呵")
The source code is obtained from the public Python minor two backstage reply resign .
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。