Python Forum
user interface Button not working
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
user interface Button not working
#1
Hello,

Cant understand why i get this error message. Anyone can give me an explaination?

from tkinter import *

def inverser():
    mot = str(EntreeMot.get())
    inversion = ""

    for carac in mot:
        inversion = carac + inversion
        txtMot.configure(text = str(inversion))

fen1 = Tk()

label1 = Label(fen1, text = "Entrez un mot:")
label1.grid(row = 0, column = 0, sticky = E)

EntreeMot = Entry(fen1)
EntreeMot.grid(row = 0, column = 1)

label2 = Label(fen1, text = "Mot inversé:")
label2.grid(row = 1, column = 0, sticky = E)

txtMot = Label(fen1, text = "")
txtMot.grid(row = 1, column = 1)

bouton = Button(fen1, text = "Inverser", command = inverser)
bouton.grid(row = 2)

fen1.mainloop()
Error:
line 31, in <module> bouton = Button(fen1, text = 'Inverser', command = inverser) NameError: name 'inverser' is not defined
Thank you
Reply


Messages In This Thread
user interface Button not working - by Frankduc - Feb-16-2022, 02:15 PM
RE: user interface Button not working - by Frankduc - Feb-16-2022, 02:52 PM
RE: user interface Button not working - by Frankduc - Feb-16-2022, 02:38 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help on the User Interface Afia 1 572 Jul-21-2023, 07:22 PM
Last Post: snippsat
  WHILE Loop - constant variables NOT working with user input boundaries C0D3R 4 1,529 Apr-05-2022, 06:18 AM
Last Post: C0D3R
  in a login interface when i try login with a user supposed to say test123 but nothing NullAdmin 3 2,322 Feb-20-2021, 04:43 AM
Last Post: bowlofred
  Help with User Interface design code ai_masti 0 1,958 Nov-19-2020, 05:58 PM
Last Post: ai_masti
  User Defined function not working Raj_Kumar 4 3,066 Dec-17-2019, 12:44 PM
Last Post: buran
  os.system("netsh interface set interface 'Wi-Fi' enabled") aniyanetworks 12 10,361 Jan-18-2019, 04:07 AM
Last Post: aniyanetworks

Forum Jump:

User Panel Messages

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