python turtle pop up window code example

Example 1: make a pop up window in python

from tkinter import *

def alert_popup(title, message, path):
    """Generate a pop-up window for special messages."""
    root = Tk()
    root.title(title)
    w = 400     # popup window width
    h = 200     # popup window height
    sw = root.winfo_screenwidth()
    sh = root.winfo_screenheight()
    x = (sw - w)/2
    y = (sh - h)/2
    root.geometry('%dx%d+%d+%d' % (w, h, x, y))
    m = message
    m += '\n'
    m += path
    w = Label(root, text=m, width=120, height=10)
    w.pack()
    b = Button(root, text="OK", command=root.destroy, width=10)
    b.pack()
    mainloop()

Example 2: turtle circle() python

import turtle
t = turtle.Turtle()
t.color(color) # choose a color
t.begin_fill() # if you want it to be filled with color later
t.circle(10) # the function "circle" and the radious.
t.end_fill() # completing the filling of the circle. 
# try to do it and see if it works. it worked for me.

Example 3: Python turtle setup

import turtle
window_Name = turtle.Sreen()
turtle_Name = turtle.Turtle()