import sys
import tkinter as tk
from tkinter import *
import tkinter.ttk as ttk
def goster():
print("ffedede")
root = tk.Tk()
root.geometry("729x506 299 135")
Ana_cerceve = ttk.Frame(root)
Ana_cerceve.place(relx=0.014, rely=0.02, relheight=0.943
, relwidth=0.97)
Text1 = tk.Text(Ana_cerceve)
Text1.place(relx=0.04, rely=0.048, relheight=0.843, relwidth=0.903
, bordermode='ignore')
Text1.insert(tk.END, goster) ????????????
root.mainloop()
CodePudding user response:
print
function writes string to terminal. It can't be displayed in Tinker.
You should write:
import sys
import tkinter as tk
from tkinter import *
import tkinter.ttk as ttk
def goster():
return "ffedede"
root = tk.Tk()
root.geometry("729x506 299 135")
Ana_cerceve = ttk.Frame(root)
Ana_cerceve.place(relx=0.014, rely=0.02, relheight=0.943
, relwidth=0.97)
Text1 = tk.Text(Ana_cerceve)
Text1.place(relx=0.04, rely=0.048, relheight=0.843, relwidth=0.903
, bordermode='ignore')
Text1.insert(tk.END, goster())
root.mainloop()