由于未知原因,我的 tkinter gui 不可见 [英] my tkinter gui is invisible for unknown reasons

查看:80
本文介绍了由于未知原因,我的 tkinter gui 不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用 tkinter 创建一个基本的 gui,我之前在另一台计算机上做过,但由于某种原因它不可见.我的代码或计算机(Windows)有问题吗?

I've been trying to create a basic gui using tkinter, I've done it before on a different computer but for some reason its invisible. Is there something wrong with my code or the computer (windows)?

import sys
from tkinter import *
mygui = Tk()
mygui.geometry('300x300+0+982')
mygui.title("my gui")
mygui.mainloop()

推荐答案

您的屏幕高度是否大于 982 像素?

Is your screen height is bigger than 982 pixel?

下一行将窗口放在(0, 982),宽度为300,高度为300.如果您的屏幕高度小于982像素,您将看不到它.

Following line place the window at (0, 982) with width 300, height 300. If your screen height smaller than 982 pixel, you can't see it.

mygui.geometry('300x300+0+982')

<小时>

将其替换为以下内容:


Replace it with following:

mygui.geometry('300x300+0+0')

你会看到的.

这篇关于由于未知原因,我的 tkinter gui 不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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