简体   繁体   English

我的程序正在运行,但已最小化

[英]My program is running, but it is minimized

def Poland():
    import turtle as t
    t.bgcolor("black")
    t.width(10)
    t.color("white")
    t.forward(50)
    t.right(90)
    t.penup()
    t.forward(10)
    t.right(90)
    t.pendown()
    t.color("red")
    t.forward(50)

Z = eval(input("Your country: "))
if (Z == Poland):
    Poland()

When I run this program and answer the question "Your country" with Poland, it does work (It opens "Python Turtle Graphics" window and draws a flag), but it is minimized.当我运行这个程序并用波兰回答“你的国家”问题时,它确实有效(它打开“Python Turtle Graphics”window 并绘制一个标志),但它被最小化了。 PLS help.请帮忙。 I am new at this.我对此很陌生。

If you want to maximize the turtle window just use:如果你想最大化海龟 window 只需使用:

t.Screen().cv._rootwindow.wm_state("zoomed")

or或者

t.Screen().cv._rootwindow.state("zoomed")

This works because turtle is nothing other than tkinter window.这是有效的,因为海龟只不过是 tkinter window。

But the window will be played in the background.但是 window 将在后台播放。

To pop it up in the first layer:在第一层弹出它:

t.Screen().cv._rootwindow.attributes("-topmost", True)

More tkinter in turtle t.Screen().cv._rootwindow.here_comes_the_tkinter_window_command更多 tkinter 在海龟t.Screen().cv._rootwindow.here_comes_the_tkinter_window_command

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

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