2016-09-22 3 views
0
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() 

ウィンドウは、常に開いているすべてのウィンドウの上部にあります。私はそれが壁紙のように底にとどまりたい。前もって感謝します!tkinterウィンドウを下に留めるには?

答えて

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() 
関連する問題