显示比桌面大的 Tkinter 窗口 [英] Showing Tkinter window larger than desktop

查看:33
本文介绍了显示比桌面大的 Tkinter 窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将使用 Tk() 创建的 Tkinter 窗口显示为大于桌面,并移动到桌面外的某些坐标.

I need to show Tkinter window, which I create with Tk(), to be larger than desktop, and moved to some coordinates outside the desktop.

不幸的是,当我这样做时:

Unfortunately when I do:

root = tk.Tk()
root.geometry("%dx%d+%d+%d", (10000, 10000, -300, -300))

然后这个窗口出现,但在桌面上最大化.

then this window shows up, but maximized on desktop.

当我首先显示窗口,然后调整大小/移动时,一切正常,但我不想在开始时看到小的空窗口.

When I show the window at first, and resize/move later, then everything is OK, but I don't want to see the small empty window at the beginning.

如何在最开始显示带有坐标和大小的窗口?

How can I show the window with the coordinates and size at the very beginning?

推荐答案

举个例子:

from Tkinter import Tk

root = Tk()

root.withdraw()
root.update_idletasks()

root.geometry("+-1000+-1000")
root.minsize(2000, 2000)

root.deiconify()

root.mainloop()

withdraw 隐藏窗口,deiconify 显示它.

withdraw hides the window, deiconify shows it.

希望有所帮助.

这篇关于显示比桌面大的 Tkinter 窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆