【问题标题】:How to move the entire window to a place on the screen (Tkinter, Python3)如何将整个窗口移动到屏幕上的某个位置(Tkinter,Python3)
【发布时间】:2015-08-03 21:28:41
【问题描述】:

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

【问题讨论】:

标签: python python-3.x tkinter


【解决方案1】:

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

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

【讨论】:

    【解决方案2】:

    使用这个:

    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)

    【讨论】:

      猜你喜欢
      • 2022-11-27
      • 1970-01-01
      • 2016-10-21
      • 2021-09-16
      • 2011-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-12
      相关资源
      最近更新 更多