import Tkinter
from Tkinter import Button
root=Tkinter.Tk()
def close_window ():
root.destroy()
w = root.winfo_screenwidth()
root.overrideredirect(1)
root.geometry("200x200+%d+200" %(w-210))
root.configure(background='gray10')
btn = Button(text='X',borderwidth=0,highlightthickness=0,bd=0,command = close_window,height="1",width="1")
btn.pack()
btn.config(bg='gray10', fg='white')
btn.config(font=('helvetica', 8))
root.mainloop()
窗口始终位于我打开的所有窗口的顶部。我希望它像壁纸一样留在底部。提前谢谢!
答案 0 :(得分:0)
你已经做得很近了。获取屏幕高度并减去窗口的高度或更多。
import Tkinter
from Tkinter import Button
root=Tkinter.Tk()
def close_window ():
root.destroy()
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
root.overrideredirect(1)
root.geometry("200x200+{0}+{1}".format(screen_width-210, screen_height-210))
root.configure(background='gray10')
btn = Button(text='X', borderwidth=0, highlightthickness=0, bd=0, command=close_window, height="1", width="1")
btn.pack()
btn.config(bg='gray10', fg='white')
btn.config(font=('helvetica', 8))
root.mainloop()