0
import tkinter
from tkinter import *
root=Tk()
root.geometry('500x500')

text = tkinter.Text(root)
text.pack()
while 1:
    x = input(">>>")
    if x == 'exit':
        break
    try:
        y = eval(x)
        if y: print(y)
    except:
        try:
            exec(x)
        except Exception as e:
            print("Error:", e)


root.mainloop()
j_4321
  • 15,431
  • 3
  • 34
  • 61
  • The while loop will block the tkinter `mainloop()` from executing. Also there is no tkinter related code in the while loop. – acw1668 May 18 '21 at 07:08
  • 4
    This question ["how-can-i-create-a-small-idle-like-python-shell-in-tkinter"](https://stackoverflow.com/questions/59164314/how-can-i-create-a-small-idle-like-python-shell-in-tkinter) may help. – acw1668 May 18 '21 at 07:16

0 Answers0