From tjreedy at udel.edu Mon Nov 2 22:04:12 2020 From: tjreedy at udel.edu (Terry Reedy) Date: Mon, 2 Nov 2020 22:04:12 -0500 Subject: [Idle-dev] Please help test astral char display in tkinter Text (especially *nix) Message-ID: tcl/tk supports unicode chars in the BMP (Basic Multilingual Plane, utf-8 encoded with 1-3 bytes). The presence of chars in other plains ('astral', utf-8 encoded with 4 bytes, I believe) in a tkinter Text widget messages up *editing*, but they can sometimes be displayed with appropriate glyphs. On my Windows 10 64-bit 2004 update, astral code points print as unassigned [X], replaced [], or proper glyphs (see below). On my up-to-date macOS Mohave, as far as I know, no glyphs are actually printed and some hang, freezing IDLE's Shell (and making extensive testing difficult). On Linux, behavior is mixed, including 'crashes', with the use of multicolor rather than black/white fonts apparently an issue. https://bugs.python.org/issue42225. I would like more information about behavior on other systems, especially *nix. The following runs to completion for me, without errors, in about 1 second. tk = True if tk: from tkinter import Tk from tkinter.scrolledtext import ScrolledText root = Tk() text = ScrolledText(root, width=80, height=40) text.pack() def print(txt): text.insert('insert', txt+'\n') errors = [] for i in range(0x10000, 0x40000, 32): chars = ''.join(chr(i+j) for j in range(32)) try: print(f"{hex(i)} {chars}") except Exception as e: errors.append(f"{hex(i)} {e}") print("ERRORS:") for line in errors: print(line) Perhaps half of the assigned chars in the first plane are printed instead of being replaced with a narrow box. This includes emoticons as foreground color outlines on background color. Maybe all of the second plane of extended CJK chars are printed. The third plane is unassigned and prints as unassigned boxes (with an X). If you get errors, how many. If you get a hang or crash, how far did the program get? -- Terry Jan Reedy From breamoreboy at gmail.com Tue Nov 3 00:54:59 2020 From: breamoreboy at gmail.com (Mark Lawrence) Date: Tue, 3 Nov 2020 05:54:59 +0000 Subject: [Idle-dev] Please help test astral char display in tkinter Text (especially *nix) In-Reply-To: References: Message-ID: On 03/11/2020 03:04, Terry Reedy wrote: > tcl/tk supports unicode chars in the BMP (Basic Multilingual Plane, > utf-8 encoded with 1-3 bytes).? The presence of chars in other plains > ('astral', utf-8 encoded with 4 bytes, I believe) in a tkinter Text > widget messages up *editing*, but they can sometimes be displayed with > appropriate glyphs. > > On my Windows 10 64-bit 2004 update, astral code points print as > unassigned [X], replaced [], or proper glyphs (see below).? On my > up-to-date macOS Mohave, as far as I know, no glyphs are actually > printed and some hang, freezing IDLE's Shell (and making extensive > testing difficult).? On Linux, behavior is mixed, including 'crashes', > with the use of multicolor rather than black/white fonts apparently an > issue.? https://bugs.python.org/issue42225.? I would like more > information about behavior on other systems, especially *nix. > > The following runs to completion for me, without errors, in about 1 second. > > tk = True > if tk: I'm not sure about the purpose of the tk variable here but hey ho. > ??? from tkinter import Tk > ??? from tkinter.scrolledtext import ScrolledText > ??? root = Tk() > ??? text = ScrolledText(root, width=80, height=40) > ??? text.pack() > ??? def print(txt): > ??????? text.insert('insert', txt+'\n') > > errors = [] > for i in range(0x10000, 0x40000, 32): > ??? chars = ''.join(chr(i+j) for j in range(32)) > ??? try: > ?????? print(f"{hex(i)} {chars}") > ??? except Exception as e: > ??????? errors.append(f"{hex(i)} {e}") > print("ERRORS:") > for line in errors: > ??? print(line) > Did you mean your 'print' here or did you intend the builtin 'print'? I assumed the latter so just renamed your 'print' to 'tkprint'. > Perhaps half of the assigned chars in the first plane are printed > instead of being replaced with a narrow box. This includes emoticons as > foreground color outlines on background color.? Maybe all of the second > plane of extended CJK chars are printed.? The third plane is unassigned > and prints as unassigned boxes (with an X). > > If you get errors, how many.? If you get a hang or crash, how far did > the program get? > Ran to completion on ubuntu in negligible time using python3.7 and 3.8. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence From 17317302007 at 189.cn Fri Nov 6 07:02:23 2020 From: 17317302007 at 189.cn (17317302007) Date: Fri, 6 Nov 2020 20:02:23 +0800 Subject: [Idle-dev] A Recommendation On Transparent IDLE (with code) Message-ID: <737958C1-CF98-41FB-8555-6DEF90767388@189.cn> An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: editor.py URL: From tjreedy at udel.edu Sat Nov 7 00:41:11 2020 From: tjreedy at udel.edu (Terry Reedy) Date: Sat, 7 Nov 2020 00:41:11 -0500 Subject: [Idle-dev] A Recommendation On Transparent IDLE (with code) In-Reply-To: <737958C1-CF98-41FB-8555-6DEF90767388@189.cn> References: <737958C1-CF98-41FB-8555-6DEF90767388@189.cn> Message-ID: On 11/6/2020 7:02 AM, 17317302007 wrote: > > Cool IDLE Developers, > > I am some little user who loves IDLE (xD). When I was taking online > courses, I thought it is better if I can use a half-transparent window > to program, while having sources or teachers' codes in the background. > (btw I use the "Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) > [MSC v.1900 64 bit (AMD64)] on win32" and I do not know if that feature > is already there in newer versions.) > For that reason, I yeeted through the code and added an "Alpha" tab on > the menu to change the transparency of the editor, being noobified by > myself (yeah I'm a noob). > Actually I just made little changes to the code... > > Thanks for making this IDLE pure Python so I have the chance to do this! > the editor.py is attached below! (In the future, please post plain text rather than html.) The last time partial transparency was discussed, the answer was that tk did not support it. However, wm attributes now support an 'alpha' attribut (and some other new ones). I am at least glad you pushed me to look. But it might be ignored on any particular window manager system. For testing, the patch added these lines text.bind("<>", lambda event: self.top.attributes("-alpha",1)) text.bind("<>", lambda event: self.top.attributes("-alpha",0.8)) text.bind("<>", lambda event: self.top.attributes("-alpha",0.6)) text.bind("<>", lambda event: self.top.attributes("-alpha",0.4)) and an 'Alpha' menu after the 'Help' menu. However, the idlelib changes since 3.6.6 are so extensive that current IDLE will not start with the revised editor.py even after the easy fixups. So I have not tested it yet. Notepad++ has an option to decrease the alpha of the Find dialog to an adjustable number either when it looses focus or always. I believe that one of these may have been the default, so some people must like it. But I did not and turned it off. To me, it seems to me even less likely to be useful for editor windows. -- Terry Jan Reedy From guido at python.org Sat Nov 7 00:47:35 2020 From: guido at python.org (Guido van Rossum) Date: Fri, 6 Nov 2020 21:47:35 -0800 Subject: [Idle-dev] A Recommendation On Transparent IDLE (with code) In-Reply-To: References: <737958C1-CF98-41FB-8555-6DEF90767388@189.cn> Message-ID: I had the same thought ? ?why would anyone want semi-transparent Windows?? I always assumed the feature existed to show off GPU features. But here we have a user who found this so useful that they wrote code to do it! So I think it would be interesting to try and understand the use case, rather than dismissing it. ?Guido On Fri, Nov 6, 2020 at 21:41 Terry Reedy wrote: > On 11/6/2020 7:02 AM, 17317302007 wrote: > > > > Cool IDLE Developers, > > > > I am some little user who loves IDLE (xD). When I was taking online > > courses, I thought it is better if I can use a half-transparent window > > to program, while having sources or teachers' codes in the background. > > (btw I use the "Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) > > [MSC v.1900 64 bit (AMD64)] on win32" and I do not know if that feature > > is already there in newer versions.) > > For that reason, I yeeted through the code and added an "Alpha" tab on > > the menu to change the transparency of the editor, being noobified by > > myself (yeah I'm a noob). > > Actually I just made little changes to the code... > > > > Thanks for making this IDLE pure Python so I have the chance to do this! > > the editor.py is attached below! > > (In the future, please post plain text rather than html.) > > The last time partial transparency was discussed, the answer was that tk > did not support it. However, wm attributes now support an 'alpha' > attribut (and some other new ones). I am at least glad you pushed me to > look. But it might be ignored on any particular window manager system. > > For testing, the patch added these lines > text.bind("<>", lambda event: > self.top.attributes("-alpha",1)) > text.bind("<>", lambda event: > self.top.attributes("-alpha",0.8)) > text.bind("<>", lambda event: > self.top.attributes("-alpha",0.6)) > text.bind("<>", lambda event: > self.top.attributes("-alpha",0.4)) > > and an 'Alpha' menu after the 'Help' menu. > > However, the idlelib changes since 3.6.6 are so extensive that current > IDLE will not start with the revised editor.py even after the easy > fixups. So I have not tested it yet. > > Notepad++ has an option to decrease the alpha of the Find dialog to an > adjustable number either when it looses focus or always. I believe that > one of these may have been the default, so some people must like it. > But I did not and turned it off. To me, it seems to me even less likely > to be useful for editor windows. > > -- > Terry Jan Reedy > > _______________________________________________ > IDLE-dev mailing list > IDLE-dev at python.org > https://mail.python.org/mailman/listinfo/idle-dev > -- --Guido (mobile) -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjreedy at udel.edu Sat Nov 7 04:09:59 2020 From: tjreedy at udel.edu (Terry Reedy) Date: Sat, 7 Nov 2020 04:09:59 -0500 Subject: [Idle-dev] A Recommendation On Transparent IDLE (with code) In-Reply-To: References: <737958C1-CF98-41FB-8555-6DEF90767388@189.cn> Message-ID: On 11/7/2020 12:47 AM, Guido van Rossum wrote: > I had the same thought ? ?why would anyone want semi-transparent Windows?? > > I always assumed the feature existed to show off GPU features. > > But here we have a user who found this so useful that they wrote code to > do it! > > So I think it would be interesting to try and understand the use case, > rather than dismissing it. I was trying to be realistic (low priority at best) rather than dismissive. Otherwise I would not have mentioned that Notepad++ has it. I don't understand why, and after getting the attached code to run with 3.6.8, I still don't. It almost seems like a niche expert feature to me. (Someone who found an obscure tk feature I did not know about is not a rank beginner ;-). Perhaps the use case would be served just as well with a multi-tabbed window or a two-paned window. Both are things I want to do and both would make it easier to flip between frames with source material, whether code or text, and code being worked on. -- Terry Jan Reedy From ronaldoussoren at mac.com Sat Nov 7 04:19:32 2020 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Sat, 7 Nov 2020 10:19:32 +0100 Subject: [Idle-dev] A Recommendation On Transparent IDLE (with code) In-Reply-To: References: <737958C1-CF98-41FB-8555-6DEF90767388@189.cn> Message-ID: <056CD9EF-C8E7-4B61-802A-83486A4E2096@mac.com> > On 7 Nov 2020, at 06:47, Guido van Rossum wrote: > > I had the same thought ? ?why would anyone want semi-transparent Windows?? > > I always assumed the feature existed to show off GPU features. > > But here we have a user who found this so useful that they wrote code to do it! > > So I think it would be interesting to try and understand the use case, rather than dismissing it. The OP mentioned that they?d like to have a transparent window to be able to see windows behind the window. In their case because they want to see the teachers materials. This might be useful when using a small screen (at least for some users). Ronald ? Twitter / micro.blog: @ronaldoussoren Blog: https://blog.ronaldoussoren.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: