Jun-25-2021, 01:15 PM
(Jun-24-2021, 10:04 PM)Yoriz Wrote: I only use windows, I am currently using windows 10 and python 3.9.4
I can create a .py file on my desktop, open it in vs code and using the following code:
import tkinter as tk from tkinter import ttk class TkApp(tk.Tk): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.entry = ttk.Entry(self) self.entry.pack(padx=5, pady=5) self.button = ttk.Button(self, text='Print', command=self.on_button) self.button.pack(pady=5) def on_button(self): print(f'Entry contains: {self.entry.get()}') if __name__ == '__main__': app = TkApp() app.mainloop()click on the little green triangle in the top right corner to run python file in terminal and it just works.
I can also double click on that .py file and it works.
Thanks @Yoriz. OK Im also running Win10 & Python 3.9.4
I copied & pasted your coding via my text editor, UltraEdit, then saved it to C:/PythonProjects/TextEditor5.py
Then pasted "python /C:/PythonProjects/TextEditor5.py" into the command box at the bottom left of the Task Bar, then hit Enter.
I was then transferred to Edge Microsoft Bing with this message - There are no results for python /C:/PythonProjects/TextEditor5.py