widget.Text param:validator using a function not takes the current value.
See original GitHub issue#works
#self.text_count = Text(label="Count", validator=lambda x: True if x.isdigit() else False)
#not works
self.text_count = Text(label="Count", validator=self._valid_char)
#_valid_char, not takes any value
@staticmethod
def _valid_char(self, char):
...
whitout staticmethod raise an exception:
TypeError: first argument must be string or compiled pattern
Is it a error?
Using: C9 IDE Python 3.5.3 (default, Apr 22 2017, 00:00:00) [GCC 4.8.4]
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How to Capture the Value of a Text Widget after the Tab ...
If you want the text to be shown before the tab space and the text to be shown with the tab space after,...
Read more >Simple ways to pass to and share data with widgets/pages
This article is going to be more practical than theoretical, I just wanted to show in a simple way, various methods to share...
Read more >Databricks widgets | Databricks on AWS
Learn how to use input widgets that allow you to add parameters to your notebooks and dashboards.
Read more >Interactivity in the custom widget - Amazon CloudWatch
action— Valid values are call , which calls a Lambda function, and html , which displays any HTML contained within <cwdb-action> . The...
Read more >24.8. Methods on Text widgets
To retrieve the current value of an option set on an embedded image, call this method with an index pointing to the image...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
OK! In that case, this is fixed. I’ll close the issue.
Note that your sample code for the instance method will hit a recursion error with this fix because you are setting a new value inside the validator. You don’t need to do this as the value is already set by the widget. The validator should simply check whether the current value is syntactically correct and return True/False accordingly.
Hold on a sec… Do you mean that you can’t use instance methods as your validator function?