Python Forum
[Tkinter] How to get & delete details from each input by clicking a button
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] How to get & delete details from each input by clicking a button
#1
from tkinter import *
import Pmw
root = Tk()
root.title('EntryField')
var = StringVar()
for i in ['First Name:','Surname','Sex:','Age:','Phone Number:','Email Address:']:
    entryfield = Pmw.EntryField(root,labelpos=W,label_text=i,label_width=15,entry_width=24,entry_textvariable=var)
    entryfield.pack(side=TOP,padx=5,pady=5)
button = Button(root,text='Register',command=lambda: print(var.get()))
button.pack(side=LEFT,pady=5,padx=5,expand=YES,fill=X)
button = Button(root,text='Cancel',command=lambda:entryfield.delete(END,var.get()))
button.pack(side=LEFT,padx=5,expand=YES,fill=X)
Hi, please how can I click on the 'Register' button and get all the information inputed into each entryfield.
Also, how can I delete each and every inputed information in the entryfield by clicking on the 'Cancel' button?
And again, please why am I tryping in one entryfield and getting it duplicated on the others. Is there how I can stop it?
Thanks.
Reply


Messages In This Thread
How to get & delete details from each input by clicking a button - by Vicolas - Jan-30-2019, 08:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Scrollable buttons with an add/delete button Clich3 5 3,476 Jun-16-2022, 07:19 PM
Last Post: rob101
  [Tkinter] Clicking on the button crashes the TK window ODOshmockenberg 1 2,258 Mar-10-2022, 05:18 PM
Last Post: deanhystad
  Need tkinter help with clicking buttons pythonprogrammer 2 2,485 Jan-03-2020, 04:43 AM
Last Post: joe_momma
  [PySimpleGui] How to alter mouse click button of a standard submit button? skyerosebud 3 5,044 Jul-21-2019, 06:02 PM
Last Post: FullOfHelp
  [Tkinter] how to input a random entry with each button press? nadavrock 1 6,431 Jun-17-2019, 05:28 AM
Last Post: Yoriz
  [Tkinter] RE: status bar to return to the centre after 1 minute of clicking a button ? chano 6 4,732 May-27-2019, 04:24 PM
Last Post: Yoriz
  tkinter- adding a new window after clicking a button built on the gui ShashankDS 2 6,647 Apr-18-2019, 12:48 PM
Last Post: ShashankDS
  [Tkinter] Adding New TAB to NoteBook Widget by Clicking Vicolas 0 2,632 Feb-15-2019, 06:03 PM
Last Post: Vicolas
  [Tkinter] Clicking a RadioButton in a for Loop & Getting the Appropriate Return Vicolas 1 5,185 Feb-02-2019, 01:53 AM
Last Post: woooee
  [PyQt] No reaction and no error message when clicking button Atalanttore 4 4,841 Nov-23-2018, 01:48 PM
Last Post: Atalanttore

Forum Jump:

User Panel Messages

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