I am a beginner in python and I would like to try to create an application involving Tkinter.
I found the VisualStudio Code application writing environment, which seems to be a pretty good application.
I noticed that it executes any script with python.exe. which has the effect of not executing the scripts involving tkinter.
I understood that it is necessary to create an environment for the development of Tkinter applications within Vs Code, an aspect about which I do not know much.
I would like to ask if you could provide me with some information or ways in which I can configure Vscode to be able to run the codes involving tkinter.
I tried to find some information on the internet about the vscode configuration but I didn't find anything relevant. An example code could be:
from tkinter import *
def main():
root = Tk ()
application = Window1 (root)
class Window1:
def __init__(self,master):
self.master = master
self.master.title('Sistem de Logare')
self.master.geometry('600x800')
self.frame = Frame(self.master)
self.frame.pack()
self.label = Label(self.frame, text = 'Hello')
self.label.grid()
self.btn = Button (self.frame , text= ' Open Window 2' , command = self.window2)
self.btn.grid()
def window2 (self):
self.window2 = Toplevel (self.master)
self.application = window2(self.window2)
class window2:
def __init__ (self,master):
self.name= StringVar()
self.master=master
self.master.title('Window2')
self.master.geometry('1350x750')
self.framew2 = Frame(self.master)
self.framew2.pack()
self.name = Entry(self.framew2, textvariable = self.name)
self.name.grid()
self.btn = Button (self.framew2 , text= ' Open Window 2' , command = '')
self.btn.grid()
if __name__ == '__main__':
main()