Python Forum

Full Version: Python Graphics Help With Entries
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I'm trying to make a flashcard maker and to start the flashcard making process I have an entry that I will check for text however when I use a while loop to check if the entry text is equal to some text it freezes my graphics screen. Any ideas?

Here is my code
from graphics import *

running = True

window_width = 500
window_height = 500
welcome_window = GraphWin(width = window_width, height = window_height)#Creates a window with a width of 1000 and a height of 1000

message1 = "Welcome to my program 'Flashcard Maker'"

welcome_message_x = 250
welcome_message_y = 100

welcome_message = Text(Point(welcome_message_x, welcome_message_y), message1)
welcome_message.setSize(15)#Sets size of the text to 30
welcome_message.draw(welcome_window)

start_message1 = "If you would like to go create flashcards type Yes into the box below"

start_message_x = 250
start_message_y = 150

start_message = Text(Point(start_message_x, start_message_y), start_message1)
start_message.setSize(15)
start_message.draw(welcome_window)

entry1 = Entry(Point(250, 200), 20)
entry1.draw(welcome_window)

entry1_text = start_message.getText()
if(entry1_text == 'Yes' or entry1_text == 'yes'):
	print("YESSSS")
	running = False

running = False
welcome_window.getMouse()#Pauses the window until a click occurs
Any loops that take some time to perform will block the GUI event loop stopping the update of any drawn items.
I think the graphics module is written on top of tkinter, see the following forum thread.
https://python-forum.io/Thread-Tkinter-H...ng-the-gui