non-blocking getkey?

Chris Angelico rosuav at gmail.com
Wed Nov 18 08:24:11 EST 2015


On Thu, Nov 19, 2015 at 12:06 AM, Ulli Horlacher
<framstag at rus.uni-stuttgart.de> wrote:
>> The limitation is that this will not work if any of the file names
>> contain astral (non-BMP) chars because tk cannot handle such characters.
>
> What are "astral chars"?

Characters not on the Basic Multilingual Plane (BMP). The Unicode
character set is divided into a number of planes of 65,536 codepoints
each, with the most commonly used ones on the first plane, the BMP. A
lot of programs either cannot use non-BMP characters or have problems
with them; for instance, anything that uses UTF-16 as its internal
representation (ECMAScript, notably; also Python 2 on Windows) sees
astral characters as pairs of code points.

> In my application the user MUST select files and directories (in one go).

It's extremely uncommon to be able to select a combination of files
and directories. The UI for this would be quite annoying, I think. You
may find it easier to have your own wrapper; for example, have a list
of selected files/directories, with buttons "Add File" and "Add
Directory" underneath. The former would use askopenfilenames (despite
the singular in the button name), and the latter would use
askdirectory. Trying to do both at once would be hard.

ChrisA



More information about the Python-list mailing list