Python Forum
Tkinter | entry output.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tkinter | entry output.
#1
Good night forum. Let me help in times of crisis. I write the key in the first line, but this key knocks out to me not in the second line, but in the terminal. How could you solve this problem? I hope for your understanding and patience. Thanks for the opportunity to get help from you. The backup copy of the script is at the bottom:

from tkinter import *
import tkinter as tk

root = Tk()

root.title('Переводчик')

fruit_r_to_e = {'яблоко':'apple', "ананас":'pineapple'}
fruit_e_to_r = {"apple": "яблоко", "pineapple": "ананас"}

mystring = tk.StringVar()
mystring1 = tk.StringVar()    

def getvalue():
    global mystring, fruit_e_to_r, fruit_r_to_e

    string = mystring.get()

    if string in fruit_e_to_r:
        print(fruit_e_to_r[string])
    
    elif string in fruit_r_to_e:
        print(fruit_r_to_e[string])

    else:
        print('This word is not in the dictionary')

def info():
    global mystring1
    print(mystring1())

name = Label(root, text='Введите слово по-русски: ')
name.pack()

entry = tk.Entry(root, textvariable = mystring)
entry.pack()

button_get = tk.Button(root, text='Перевести', command=getvalue)
button_get.pack()

label_data = Label(root, fg='red')
label_data.pack(side=LEFT, pady=10)

entry = tk.Entry(root, textvariable=mystring1)
entry.pack()

label = Label(root, text='Английский язык')
label.pack()

root.mainloop()
Reply


Messages In This Thread
Tkinter | entry output. - by Sap2ch - Sep-24-2021, 10:01 PM
RE: Tkinter | entry output. - by Yoriz - Sep-25-2021, 12:38 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Making entry global in tkinter with multiprocessing luckyingermany 2 2,321 Jan-21-2022, 03:46 PM
Last Post: deanhystad
  Tkinter Exit Code based on Entry Widget Nu2Python 6 2,985 Oct-21-2021, 03:01 PM
Last Post: Nu2Python
  [Tkinter] Update variable using tkinter entry methon drSlump 6 5,201 Oct-15-2021, 08:01 AM
Last Post: drSlump
  .get() from generated Entry widgets in tkinter snakes 4 4,220 May-03-2021, 11:26 PM
Last Post: snakes
  [Tkinter] acceleration of data output in treeview tkinter Vladimir1984 4 4,175 Nov-21-2020, 03:43 PM
Last Post: Vladimir1984
  Entry Validation in tkinter shahulvk 4 16,316 Oct-28-2020, 10:12 PM
Last Post: joe_momma
  Displaying output in GUI ( Tkinter) Zouloutamtam 7 18,378 Sep-29-2020, 02:08 PM
Last Post: Zouloutamtam
  [Tkinter] Getting Input from Tkinter Entry juliabrushett 6 21,352 May-30-2020, 03:29 PM
Last Post: Larz60+
  Converting Entry field value to integer in tkinter scratchmyhead 2 4,949 May-11-2020, 03:41 PM
Last Post: scratchmyhead
  [Tkinter] Tkinter adding entry values scratchmyhead 1 2,196 May-04-2020, 05:21 AM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020