Skip to content
Advertisement

Tkinter output to GUI textbox

new to GUI creation with python, I have the following code, how can I make the print command appear on the GUI not the command line? I’m wanting to show the print in the GUI as a text box or some kind of output window so the process can be shown.

JavaScript

Advertisement

Answer

You can add a label for output underneath loginButton:

JavaScript

Then replace print(response.text) with output.set(reponse.text) to change the text in your label.

Edit for ScrolledText
Add from tkinter import scrolledtext to the top. Remove output = StringVar() and replace outputLabel = ... with

JavaScript

Then, in validateLogin, replace output.set(...) with

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement