Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How To Re-Enter Data For A Specific Field - AND 'CR to act like TAB #6741

Open
10 tasks
MikeGreen99 opened this issue Apr 12, 2024 · 1 comment
Open
10 tasks
Labels
Port - TK PySimpleGUI question Further information is requested

Comments

@MikeGreen99
Copy link

MikeGreen99 commented Apr 12, 2024

Type of Issue (Enhancement, Error, Bug, Question)

Question


Operating System

ubuntu 22.04

PySimpleGUI Port (tkinter, Qt, Wx, Web)

tkinter


Versions

Version information can be obtained by calling sg.main_get_debug_data()
Or you can print each version shown in ()

Python version (sg.sys.version)

3.12

PySimpleGUI Version (sg.__version__)

PySimpleGUI 5.0

GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)

PySimpleGUI 5.0


Your Experience In Months or Years (optional)

Years Python programming experience 6 months

Years Programming experience overall 40

Have used another Python GUI Framework? No

Anything else you think would be helpful?


Troubleshooting

These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

  • Searched main docs for your problem PySimpleGUI Documenation
  • Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demo Programs
  • None of your GUI code was generated by an AI algorithm like GPT
  • If not tkinter - looked for Demo Programs for specific port
  • For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
  • Run your program outside of your debugger (from a command line)
  • Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.com
  • Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
  • Tried running the Development Build. Your problem may have already been fixed but not released. Check Home Window for release notes and upgrading capability
  • For licensing questions please email license@PySimpleGUI.com

Detailed Description

First Question:
All Fields are mandatory on my 3 Field screen. Using a mouse click, it is possible to bypass the AGE Field. Then SUBMIT is pressed.

I would then check to see that none of the Fields are NULL (empty). If I determine that the AGE Field (or any Field) is NULL, how do I go back and ask for it to be re-entered ?

Second Question:
If a Field is entered followed by a Carriage Return - is there any way to make it act like the TAB key and go on to the next Field ?

Thanks,
M....

Code To Duplicate

import PySimpleGUI as sg

layout = [
    [sg.Text('Name: ',tooltip='Name 3-31 Char'),sg.Input(default_text ="",enable_events=True,key='-NAME-')],
    [sg.Text('Age:    ', tooltip='Age 16-99'), sg.Input(default_text="",enable_events=True,key='-AGE-')],
    [sg.Text('Date:   ', tooltip='Date YYMMDD'), sg.Input(default_text="",enable_events=True,key='-DATE-')],
    [sg.Button("Update"), sg.Button("Exit")],
	]
winx = sg.Window('Customer Data Entry', layout)

while True:
    event, values = winx.read()         # Display Window & wait for an event
    if event == 'Exit' or event == sg.WINDOW_CLOSE_ATTEMPTED_EVENT: # Exit button or upper left X
       break

    if event == '-NAME-' :  # Name Validation
        print("Name Validation")

    if event == '-AGE-' and values['-AGE-'][-1] not in ('0123456789'):  # Age Validation
       winx['-AGE-'].update(values['-AGE-'][:-1]) # delete last char from input
       print("Age Validation")

    if event == '-DATE-':
       print("Date Validation")

    if event == '-UPDATE-':
        # Check for missing fields
        print("Update File")

winx.close()

Screenshot, Sketch, or Drawing


Watcha Makin?

If you care to share something about your project, it would be awesome to hear what you're building.

@pysimpleissue pysimpleissue bot closed this as completed Apr 12, 2024
@jason990420 jason990420 changed the title Question [Question] How To Re-Enter Data For A Specific Field - AND 'CR to act like TAB Apr 12, 2024
@pysimpleissue pysimpleissue bot removed Fill issue form or you will be REJECTED You MUST use the supplied template to submit a request. PySimpleGUI Issues Bot Has Detected an Error labels Apr 12, 2024
@pysimpleissue pysimpleissue bot reopened this Apr 12, 2024
Repository owner deleted a comment from pysimpleissue bot Apr 12, 2024
Repository owner deleted a comment from pysimpleissue bot Apr 12, 2024
@jason990420
Copy link
Collaborator

I would then check to see that none of the Fields are NULL (empty)

Validate all values of all your Input elements when event "Update" in your event loop.

how do I go back and ask for it to be re-entered ?

IMO, you can call sg.popup or similarities to display a popup window to alarm if validation failed.

If a Field is entered followed by a Carriage Return - is there any way to make it act like the TAB key and go on to the next Field ?

Please refer Issue #5291 #5291 (comment)

@jason990420 jason990420 added question Further information is requested Port - TK PySimpleGUI labels Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Port - TK PySimpleGUI question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants