| Ticket UUID: | 80f2e1ad79e3432062afc656e8079e6b26a6f4e9 | |||
| Title: | combobox autocomplete in readonly mode | |||
| Type: | Bug | Version: | ||
| Submitter: | anonymous | Created on: | 2022-01-29 10:51:35 | |
| Subsystem: | 88. Themed Tk | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Open | Last Modified: | 2022-03-10 18:15:36 | |
| Resolution: | None | Closed By: | nobody | |
| Closed on: | ||||
| Description: |
Using combobox like this (python): <verbatim> g1 = ttk.Combobox(site_frame, values=guards, width=15) g1.state(["readonly"]) </verbatim> the guards list could be long. I want the user to be able to click on the combobox, then type first letter and let the user jump to entry in the values. Note I want this for readonly combobox so the user cannot entry arbitrary value, the user must choose from the list, but the keypress lets them jump to the values quickly without having to scroll a long list of values. similar feature mentioned here: [https://mail.python.org/pipermail/tkinter-discuss/2012-January/003041.html] (this one might not be a readonly combobox though) would be nice if this feature was built into ttk combobox natively. thanks in advance. | |||
| User Comments: |
fvogel added on 2022-03-10 18:15:36:
A possibly useful reference: https://github.com/jcowgar/misctcl fvogel added on 2022-02-05 16:09:04: Yeah, putting the feature into Tk mainstream would be the right way to make it available from software like Python. This needs someone to pick up this RFE, write an implementation patch (drawing inspiration from the wiki - or not), and update the man page and the test suite. And a TIP needs to be written. The Tk target version will be 8.7 since this is a new feature. Nothing I have just mentioned is difficult, we just need someone to pick this up. anonymous added on 2022-02-04 08:54:43: Thanks for the reply. This sounds far out of my scope. I am indeed distributing the app, to linux and windows to top things off. I won't attempt this I think. Any scope of having this be put into tk mainstream, to allow it to be a default experience? That way it will be official, and therefore lang bindings like python could add support to also make it a default experience? fvogel added on 2022-02-03 21:13:10: Caveat: I didn't try in practice.
You probably could add code from the wiki at the end of your file /usr/share/tcltk/tk8.6/ttk/combobox.tcl
proc ComboBoxAutoComplete {path key} { ...
Then you would need to make the combobox aware of the new feature:
bind .c <KeyRelease> [list ComboBoxAutoComplete %W %K]
(adapt the above by replacing .c by the pathname of your combobox in your app, in your example that's .g1).
But all this is in Tcl/Tk, this probably won't work out of the box from Python.
You will have some research/development to do to make this work. And if you're distributing the developed result, that's also something to consider.
Sorry, I can't do this job for you.
anonymous added on 2022-02-03 09:30:49: I see on my system this file: /usr/share/tcltk/tk8.6/ttk/combobox.tcl So I guess I need changes from https://github.com/jcowgar/misctcl/blob/master/combobox/combobox.tcl So I replace my local file with the github one, or do I append the github into my local file, or do I make a new file in the /usr/share/tcltk/tk8.6/ttk/ dir and paste github code into new file? I'm not familiar with tcl files at all, sorry for my ignorance. Thanks. anonymous added on 2022-02-02 12:33:46: How and where would I put in the code changes then? Sorry I have zero knowledge of tk native, I use from python and I only know python side of it. Possible for you to guide me on where on linux mint (ubuntu based) I need to put these changes into, and exactly what changes I should put in. I do not know the tk syntax, I only know python. Thank you in advance for all your time and assistance in helping me with my issue. fvogel added on 2022-01-30 20:35:06: > does this mean it should work out the box/default? No. > Or I should use the code changes in the link you mentioned? Yes. > The autocompletion part of the link has comments looking like 2010, 2015 > etc. Looks out of date? Probably not. > libtk8.6:amd64 8.6.10-1 > libtcl8.6:amd64 8.6.10+dfsg-1 > > Am I maybe running packages that are too old? No these packages look fine. anonymous added on 2022-01-30 17:33:46: Hi, does this mean it should work out the box/default? Or I should use the code changes in the link you mentioned? The autocompletion part of the link has comments looking like 2010, 2015 etc. Looks out of date? Note: I am using python tkinter, I am not familiar with tk/tcl code otherwise. Currently in my python app the readonly combobox does not autocomplete/jump to value on keypress. versions installed: linux mint 20.3 (ubuntu focal) python 3.8.10 python3-tk:amd64 3.8.10-0ubuntu1~20.04 libtk8.6:amd64 8.6.10-1 libtcl8.6:amd64 8.6.10+dfsg-1 tk8.6-blt2.5 2.5.3+dfsg-4 Am I maybe running packages that are too old? Any other info or detail needed from me, please do let me know. fvogel added on 2022-01-29 16:08:55: The wiki provides ready-to-use (Tcl/Tk) code providing the required feature: https://wiki.tcl-lang.org/page/ttk%3A%3Acombobox I didn't try this code in practice though, but from a cursive reading it seems the readonly combobox case is supported, at least by some of the implementations in that page. | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki