1
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. PLS help. I am new at this.

Marat
  • 15,215
  • 2
  • 39
  • 48
Luka
  • 13
  • 4
  • 3
    Unrelated, but why `eval(input(..))`? (Are you aware you can wipe your hard disk that way?) – Jongware May 12 '20 at 21:46
  • It is in the task bar (minimized) Example: When you open google and click that "-" in the high right corner It will bring you to your desktop and left it open in the task bar. – Luka May 12 '20 at 21:47
  • what can I use instead of that? – Luka May 12 '20 at 21:49
  • what can I put instead of eval(input(…)) – Luka May 12 '20 at 21:51
  • A better tutorial, a more modern version of Python, or, if all else fails, reading [the official documentation](https://docs.python.org/2.7/library/functions.html#input). – Jongware May 12 '20 at 21:52
  • Can you pls make example with my code so I can use it in other programs instead of eval(inpu(…)) – Luka May 12 '20 at 21:57
  • Sure. Go to [this link](https://www.python.org/downloads/) to install a version that is not hopelessly out of date, obsolete, and no longer supported. – Jongware May 12 '20 at 22:01
  • In Python3, `Z = input("Your country: "); if (Z == 'Poland'): ...`. For Python2, replace `input()` with `raw_input()` – Marat May 12 '20 at 22:04
  • thanks, the latest version installed, what should I do next – Luka May 12 '20 at 22:05
  • `eval(input())` takes user input and then executes it as a Python program, which might be unsafe to run. What you probably want instead is just to take an input string and compare it against some other value. – Marat May 12 '20 at 22:06
  • sorry, I do not really understand, can you pls show an example with eval(input(…)) and without it? – Luka May 12 '20 at 22:09
  • sry, I did not see your second msg – Luka May 12 '20 at 22:09
  • 10q so much, everything is working now. – Luka May 12 '20 at 22:46

1 Answers1

0

If you want to maximize the turtle window just use:

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

or

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

This works because turtle is nothing other than tkinter window.

But the window will be played in the background.

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

math scat
  • 310
  • 8
  • 17