![](/img/trans.png)
[英]Take screenshot of python tkinter window (NOT entire computer screen)
[英]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.