From Vasilis.Vlachoudis at cern.ch Wed Mar 16 12:16:36 2022 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Wed, 16 Mar 2022 16:16:36 +0000 Subject: [Tkinter-discuss] 4k HiDPI displays and tkinter [cont] Message-ID: <0BC70B5D93E054469872FFD0FE07220E03386223A7@CERNXCHG53.cern.ch> On the same topic of HiDPI screens, the Treeview seems to calculate wrongly the font height (see attach image) Do you know any way to correct that? Vasilis -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screenshot_2022-03-16_17-10-17.png Type: image/png Size: 177880 bytes Desc: Screenshot_2022-03-16_17-10-17.png URL: From klappnase at web.de Thu Mar 17 05:35:57 2022 From: klappnase at web.de (Michael Lange) Date: Thu, 17 Mar 2022 10:35:57 +0100 Subject: [Tkinter-discuss] 4k HiDPI displays and tkinter [cont] In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E03386223A7@CERNXCHG53.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E03386223A7@CERNXCHG53.cern.ch> Message-ID: <20220317103557.37a1424e46a6d31c93c570a9@web.de> Hi, On Wed, 16 Mar 2022 16:16:36 +0000 Vasilis Vlachoudis wrote: > On the same topic of HiDPI screens, the Treeview seems to calculate > wrongly the font height (see attach image) > Do you know any way to correct that? > are you possibly using a point-sized font? If yes, maybe there is some dpi issue again? Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. No problem is insoluble. -- Dr. Janet Wallace, "The Deadly Years", stardate 3479.4 From Vasilis.Vlachoudis at cern.ch Thu Mar 17 05:47:16 2022 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Thu, 17 Mar 2022 09:47:16 +0000 Subject: [Tkinter-discuss] 4k HiDPI displays and tkinter [cont] In-Reply-To: <20220317103557.37a1424e46a6d31c93c570a9@web.de> References: <0BC70B5D93E054469872FFD0FE07220E03386223A7@CERNXCHG53.cern.ch>, <20220317103557.37a1424e46a6d31c93c570a9@web.de> Message-ID: <0BC70B5D93E054469872FFD0FE07220E0338622559@CERNXCHG53.cern.ch> Hi Michael, no I am using the default fonts. What is different is the I have set a high DPI for the X-server to match the screen resolution. I saw in the page https://www.tcl.tk/man/tcl/TkCmd/ttk_treeview.html under "Styling Options' there is parameter to set the -rowheight that needs to be defined as ttk::style configure Treeview \ -rowheight [expr {[font metrics font -linespace] + 2}] however I could not find how to call this command, and when If I do the following style = ttk.Style() style.configure("Treeview", rowheight="30") it works, but it is not dynamic with the font size/dpi Vasilis ________________________________________ From: Tkinter-discuss [tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org] on behalf of Michael Lange [klappnase at web.de] Sent: Thursday, March 17, 2022 10:35 To: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] 4k HiDPI displays and tkinter [cont] Hi, On Wed, 16 Mar 2022 16:16:36 +0000 Vasilis Vlachoudis wrote: > On the same topic of HiDPI screens, the Treeview seems to calculate > wrongly the font height (see attach image) > Do you know any way to correct that? > are you possibly using a point-sized font? If yes, maybe there is some dpi issue again? Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. No problem is insoluble. -- Dr. Janet Wallace, "The Deadly Years", stardate 3479.4 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org https://mail.python.org/mailman/listinfo/tkinter-discuss From klappnase at web.de Thu Mar 17 06:25:18 2022 From: klappnase at web.de (Michael Lange) Date: Thu, 17 Mar 2022 11:25:18 +0100 Subject: [Tkinter-discuss] 4k HiDPI displays and tkinter [cont] In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E0338622559@CERNXCHG53.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E03386223A7@CERNXCHG53.cern.ch> <20220317103557.37a1424e46a6d31c93c570a9@web.de> <0BC70B5D93E054469872FFD0FE07220E0338622559@CERNXCHG53.cern.ch> Message-ID: <20220317112518.b9bdaf4abc91897ad1b7e01d@web.de> Hi, On Thu, 17 Mar 2022 09:47:16 +0000 Vasilis Vlachoudis wrote: > Hi Michael, > > no I am using the default fonts. > What is different is the I have set a high DPI for the X-server to > match the screen resolution. > > I saw in the page > https://www.tcl.tk/man/tcl/TkCmd/ttk_treeview.html > > under "Styling Options' > there is parameter to set the -rowheight > that needs to be defined as > > ttk::style configure Treeview \ > -rowheight [expr {[font metrics font -linespace] + 2}] > > however I could not find how to call this command, and when > If I do the following > > style = ttk.Style() > style.configure("Treeview", rowheight="30") > > it works, but it is not dynamic with the font size/dpi you could do something like >>> f=font.Font(name='TkDefaultFont', exists=1) >>> rowheight=f.metrics('linespace')+2 >>> rowheight 17 This value is in pixels; I am not sure, if you did something to the dpi setting, maybe you still need to increase this value somehow according to the scaling factor in use, which you should be able to query with: >>> root.tk.call('tk', 'scaling') 1.2450980392156863 I am just doing guesswork here, though. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. It would be illogical to kill without reason. -- Spock, "Journey to Babel", stardate 3842.4 From Vasilis.Vlachoudis at cern.ch Wed Mar 23 04:16:57 2022 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Wed, 23 Mar 2022 08:16:57 +0000 Subject: [Tkinter-discuss] 4k HiDPI displays and tkinter [cont] In-Reply-To: <20220317112518.b9bdaf4abc91897ad1b7e01d@web.de> References: <0BC70B5D93E054469872FFD0FE07220E03386223A7@CERNXCHG53.cern.ch> <20220317103557.37a1424e46a6d31c93c570a9@web.de> <0BC70B5D93E054469872FFD0FE07220E0338622559@CERNXCHG53.cern.ch>, <20220317112518.b9bdaf4abc91897ad1b7e01d@web.de> Message-ID: <0BC70B5D93E054469872FFD0FE07220E033862431B@CERNXCHG53.cern.ch> I forgot to reply to you, >>> f=font.Font(name='TkDefaultFont', exists=1) >>> rowheight=f.metrics('linespace')+2 >>> rowheight works beautifully. Many thanks!!