Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In Python Visual Studios 2017 enterprise, is there a way to see something you ha

ID: 3853230 • Letter: I

Question

In Python Visual Studios 2017 enterprise, is there a way to see something you have created visually? For example, I am trying to open a simple window, or two, by entering code such as below:

from tkinter import *

a=tk()

a.title("my first window")

import tkinter

root=tkinter.tk()

root.title("second window")

but nothing emerges. The code has no errors and seems to run okay. I am very new to doing anything involving GUI so probably not understanding fully how to interact with the software and GUI. I am expecting a window to pop up on my computer but nothing does. I am simply following examples on how to start using GUI.

Explanation / Answer

The answer is as follows:

A possible code to display the window is as follows:

import tkinter
root=tkinter.tk()
root.title("second window")
root.mainloop() //For drawing the window and starting the application.

root.mainloop() is a method on the main window which we execute when we want to run our application. This method will loop forever, waiting for events from the user, until the user exits the program – either by closing the window, or by terminating the program with a keyboard interrupt in the console.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote