A
A
Alex_Kuzen2021-07-23 08:08:34
Python
Alex_Kuzen, 2021-07-23 08:08:34

Why are the words not showing up?

import tkinter as tk 

win = tk.Tk()
win.geometry('1000x900+150+150')
win.title('Тест текст')


def btn():
  button = tk.Button(win, text = 'Отправить ', command = message_import)
  button.grid(column = 0, row =1)


message_export = tk.Text(win, height = 10, width = 40)
message_export.grid(column=1,row =1)


def message_import():	
  message = str(message_export)

  ms_import = tk.Label(win, text = message 
    )

  ms_import.grid(column=3,row=1)



btn()


win.mainloop()


When you click on the "Submit" button, .!text is displayed Instead of the entered text.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-07-23
@Alex_Kuzen

Because you need to get the value of the text field, and you are accessing the object itself
message = message_export.get('1.0', 'end')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question