prompt-toolkit / prompt-toolkit/python-prompt-toolkit

can you add event handle examples

Open
#1,203 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

Even thought I think this requires me to do a little more research on my part (I am still trying to learn python). I think have an event example would be nice to have in your doc.

it sayes here

Don’t hesitate to open a GitHub issue if you feel that a certain example is missing.

I am getting really confuse on how to pass object on an event and don't even know if it is possible and would be nice if there were some example.

I have a lot of button on the full screen application using the prompt toolkit and I want all of them to call the same function and have it pass the button pushed in the argument so the callback would look something like this.

def onCheckButtonSel(button): 
   if(button.name == '1'):
         print(" check box 1 clicked") 
   if(button.name == '2'):
         print("check box  2 click")
  if(button.parent.name ==menu):
         print("this call from the menu") 

Is this type of thing possible?

If so can you give some example on this?

If not would you be against added something like this to you prompt-toolkit?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked full-screen applications documentation and the issue’s proposed shared callback shape. Determine how event callbacks receive the selected button or object, then add a documentation example that answers whether this usage is supported and demonstrates the requested pattern.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.