繁体   English   中英

如何将整个窗口移动到屏幕上的某个位置(Tkinter,Python3)

[英]How to move the entire window to a place on the screen (Tkinter, Python3)

标题说明了一切。 如何使用 tkinter 将整个窗口移动到屏幕上的某个位置。 这应该是移动根框架。

使用根(或任何顶层)窗口的几何方法。 例如:

import tkinter as tk
root = tk.Tk()
root.geometry("+200+400") # places the window at 200,400 on the screen

用这个:

from tkinter import Tk

main=Tk()
main.geometry('+100+200')
main.mainloop()

或者用函数来做:

def change_position(root_variable,x,y):
    root_variable.geometry('+{}+{}'format(x,y))

并使用: change_position(main,500,400)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM