Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1002665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:51:44+00:00 2026-05-16T07:51:44+00:00

I have a list of n Entry widgets. The user should be able to

  • 0

I have a list of n Entry widgets. The user should be able to type only the following charaters: “V”, “F”, ” “. If the user types one of those characters, the focus should pass from Entry #x to Entry #x+1, otherwise the focus should stay where it is (on Entry #x) and the input should be discarded.

I am not able to discard the wrong input: if the user presses a key different from those allowed, the Entry field get that key, but the command .delete(0,END) doesn’t work, as the widget itself hasn’t yet memorized the key pressed.

How could I do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:51:45+00:00Added an answer on May 16, 2026 at 7:51 am
    import Tkinter as tk
    
    def keyPress(event):
        if event.char in ('V', 'F', ' '):
            print event.char
        elif event.keysym not in ('Alt_r', 'Alt_L', 'F4'):
            print event.keysym
            return 'break'
    
    
    root = tk.Tk()
    entry = tk.Entry()
    entry.bind('<KeyPress>', keyPress)
    entry.pack()
    entry.focus()
    
    root.mainloop()
    

    You can easily break up the statement so it will go to a different form based on the key.

    The event.keysym part is in there so you can ALT-F4 to close the app when you’re in that widget. If you just else: return 'break' then it will capture all other keystrokes as well.

    This also is a case sensitive capture. If you want case insensitive, just change it to event.char.upper()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one list of entries, and these entry shorted by alphabetically, now I
I have just found the possibilty to determine a type of a list entry
I am developing silverlight web part. I have a one List Entry log. In
In the entry form of my wpf application, I have a list of buttons
I have the following code in my index view. latest_entry_list = Entry.objects.filter(is_published=True).order_by('-date_published')[:10] for entry
i have list of rows that user select and i want to delete them,
I have list of words. I type in a word misspelled. Can I query
I have list of files which contain particular patterns, but those files have been
I have this and guess that this list is a sortable one: <ul> <li
I am have a list of Entries I want to get the first entry

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.