From Vasilis.Vlachoudis at cern.ch Sun Jun 2 10:22:56 2019 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Sun, 2 Jun 2019 14:22:56 +0000 Subject: [Tkinter-discuss] ttk.Notebook: autohide In-Reply-To: <20190531003322.22a3008bed28a011b6a3f39e@web.de> References: <0BC70B5D93E054469872FFD0FE07220E0288FD914D@CERNXCHG51.cern.ch> <20190529235650.b1e1217391893b3b17e67e7d@web.de> <0BC70B5D93E054469872FFD0FE07220E0288FDAB3E@CERNXCHG51.cern.ch>, <20190531003322.22a3008bed28a011b6a3f39e@web.de> Message-ID: <0BC70B5D93E054469872FFD0FE07220E0288FDBB3D@CERNXCHG51.cern.ch> Many thanks The first solution works ok for me without any flickering I think you are right it is a bug in tk, probably they forget to invalidate the window Vasilis ________________________________________ From: Tkinter-discuss [tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org] on behalf of Michael Lange [klappnase at web.de] Sent: Friday, May 31, 2019 00:33 To: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] ttk.Notebook: autohide Hi, On Thu, 30 May 2019 19:49:33 +0000 Vasilis Vlachoudis wrote: > Many thanks Michael. > The recipe works the tab bar disappears (and reappears), but the space > of the tabs is not reclaimed. the child-window is not resized to get > the extra space. If I resize the toplevel window with the mouse then it > works. oh, I see. This "works" also vice versa here, the tab only reappears after resizing the window with the mouse. Too bad, looks like a bug to me. > > Is there a way to force the layout manager to recalculate all widgets? > I am not sure how to do this, except with an ugly hack like: def hidetabs(ev): s.layout('TNotebook.Tab', []) nb.pack(expand=0) nb.update_idletasks() nb.pack(fill='both', expand=1) But that looks rather stupid and besides causes an annoying "flickering" effect. The flickering seems to be a bit better with a "minimally invasive" re-packing, as in def hidetabs(ev): s.layout('TNotebook.Tab', []) info = nb.pack_info() px = info['padx'] del info['padx'] nb.pack(padx=px + 1, **info) nb.update_idletasks() nb.pack(padx=px, **info) but this looks somehow even more stupid. But maybe I just miss something obvious? Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. "Can you imagine how life could be improved if we could do away with jealousy, greed, hate ..." "It can also be improved by eliminating love, tenderness, sentiment -- the other side of the coin" -- Dr. Roger Corby and Kirk, "What are Little Girls Made Of?", stardate 2712.4 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org https://mail.python.org/mailman/listinfo/tkinter-discuss From klappnase at web.de Tue Jun 4 03:51:02 2019 From: klappnase at web.de (Michael Lange) Date: Tue, 4 Jun 2019 09:51:02 +0200 Subject: [Tkinter-discuss] ttk.Notebook: autohide In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E0288FDBB3D@CERNXCHG51.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E0288FD914D@CERNXCHG51.cern.ch> <20190529235650.b1e1217391893b3b17e67e7d@web.de> <0BC70B5D93E054469872FFD0FE07220E0288FDAB3E@CERNXCHG51.cern.ch> <20190531003322.22a3008bed28a011b6a3f39e@web.de> <0BC70B5D93E054469872FFD0FE07220E0288FDBB3D@CERNXCHG51.cern.ch> Message-ID: <20190604095102.ee47dfdf17f958433067291e@web.de> Hi, On Sun, 2 Jun 2019 14:22:56 +0000 Vasilis Vlachoudis wrote: > Many thanks > > The first solution works ok for me without any flickering probably it depends on the speed of the machine. With an old and slow laptop of mine the flickering effect appears to be a bit worse than on my desktop machine. Changing only the padx by one pixel seems to cause only a slightly "trembling" effect that is hardly noticable at all, so I guess the second workaround might be a bit better. (Maybe calling those workarounds "stupid" the other day was a bit harsh, if there's actually nothing better the second version might be not so bad) > > I think you are right it is a bug in tk, probably they forget > to invalidate the window Still I am not sure if I didn't miss something here. I think one bad thing about ttk is that the more advanced operations on styles and themes aren't really documented very well, so I always find it hard to find out how to do things properly, I always end up with some try-and-error solution. Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Death. Destruction. Disease. Horror. That's what war is all about. That's what makes it a thing to be avoided. -- Kirk, "A Taste of Armageddon", stardate 3193.0 From Vasilis.Vlachoudis at cern.ch Mon Jun 17 08:16:49 2019 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Mon, 17 Jun 2019 12:16:49 +0000 Subject: [Tkinter-discuss] Text to postscript Message-ID: <0BC70B5D93E054469872FFD0FE07220E0288FF43B2@CERNXCHG51.cern.ch> Hi all, Canvas has this nice method to convert it to postscript, which is perfect for printing. Is there something similar for Text(), I could not find anything internal but if there is something external to convert to html, ps, pdf it would be nice. Many thanks Vasilis -------------- next part -------------- An HTML attachment was scrubbed... URL: From klappnase at web.de Tue Jun 18 05:16:12 2019 From: klappnase at web.de (Michael Lange) Date: Tue, 18 Jun 2019 11:16:12 +0200 Subject: [Tkinter-discuss] Text to postscript In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E0288FF43B2@CERNXCHG51.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E0288FF43B2@CERNXCHG51.cern.ch> Message-ID: <20190618111612.189575d9e079d6a1f0b1f116@web.de> Hi, On Mon, 17 Jun 2019 12:16:49 +0000 Vasilis Vlachoudis wrote: > Hi all, > > Canvas has this nice method to convert it to postscript, which is > perfect for printing. Is there something similar for Text(), I could > not find anything internal but if there is something external to > convert to html, ps, pdf it would be nice. maybe you could use tkimg to create a "screenshot" of the widget in postscript format. To enable tkimg's "window" handler once it's installed you just need to do something like root.tk.call('package', 'require', 'img::window') early in your code. IIRC by default tkimg's "window" handler will include only the visible part of the widget, but here: https://wiki.tcl-lang.org/page/Img George Petasis posted a recipe that seems to be able to capture the whole contents of a canvas widget. I don't know how well this actually works though and if it can be done with a Text widget in the same fashion. Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. History tends to exaggerate. -- Col. Green, "The Savage Curtain", stardate 5906.4 From Vasilis.Vlachoudis at cern.ch Tue Jun 18 06:09:08 2019 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Tue, 18 Jun 2019 10:09:08 +0000 Subject: [Tkinter-discuss] Text to postscript In-Reply-To: <20190618111612.189575d9e079d6a1f0b1f116@web.de> References: <0BC70B5D93E054469872FFD0FE07220E0288FF43B2@CERNXCHG51.cern.ch>, <20190618111612.189575d9e079d6a1f0b1f116@web.de> Message-ID: <0BC70B5D93E054469872FFD0FE07220E0288FF6138@CERNXCHG51.cern.ch> Thanks Michael, not exactly what I was looking for. I am investigating how difficult is to write my own ps exporter, based on the Canvas postscript source code. Vasilis ________________________________________ From: Tkinter-discuss [tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org] on behalf of Michael Lange [klappnase at web.de] Sent: Tuesday, June 18, 2019 11:16 To: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] Text to postscript Hi, On Mon, 17 Jun 2019 12:16:49 +0000 Vasilis Vlachoudis wrote: > Hi all, > > Canvas has this nice method to convert it to postscript, which is > perfect for printing. Is there something similar for Text(), I could > not find anything internal but if there is something external to > convert to html, ps, pdf it would be nice. maybe you could use tkimg to create a "screenshot" of the widget in postscript format. To enable tkimg's "window" handler once it's installed you just need to do something like root.tk.call('package', 'require', 'img::window') early in your code. IIRC by default tkimg's "window" handler will include only the visible part of the widget, but here: https://wiki.tcl-lang.org/page/Img George Petasis posted a recipe that seems to be able to capture the whole contents of a canvas widget. I don't know how well this actually works though and if it can be done with a Text widget in the same fashion. Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. History tends to exaggerate. -- Col. Green, "The Savage Curtain", stardate 5906.4 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org https://mail.python.org/mailman/listinfo/tkinter-discuss From paul at tartan.co.za Tue Jun 18 09:57:03 2019 From: paul at tartan.co.za (Paul Malherbe) Date: Tue, 18 Jun 2019 15:57:03 +0200 Subject: [Tkinter-discuss] Text to postscript In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E0288FF6138@CERNXCHG51.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E0288FF43B2@CERNXCHG51.cern.ch> <20190618111612.189575d9e079d6a1f0b1f116@web.de> <0BC70B5D93E054469872FFD0FE07220E0288FF6138@CERNXCHG51.cern.ch> Message-ID: An HTML attachment was scrubbed... URL: From klappnase at web.de Tue Jun 18 17:18:47 2019 From: klappnase at web.de (Michael Lange) Date: Tue, 18 Jun 2019 23:18:47 +0200 Subject: [Tkinter-discuss] Text to postscript In-Reply-To: References: <0BC70B5D93E054469872FFD0FE07220E0288FF43B2@CERNXCHG51.cern.ch> <20190618111612.189575d9e079d6a1f0b1f116@web.de> <0BC70B5D93E054469872FFD0FE07220E0288FF6138@CERNXCHG51.cern.ch> Message-ID: <20190618231847.46b9a8b145fa588c39bd59c0@web.de> Hi, On Tue, 18 Jun 2019 15:57:03 +0200 Paul Malherbe wrote: > You could use fpdf to convert text to pdf as per: (...) as I understood (or imagined?) the OP wants to keep some sort of formatting within the Text widget, like tags with different fonts or embedded images etc. If it's only about "plain text" it should be possible to "copy" the text and the used font to a canvas text element and then use Canvas.postscript(). Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. The people of Gideon have always believed that life is sacred. That the love of life is the greatest gift ... We are incapable of destroying or interfering with the creation of that which we love so deeply -- life in every form from fetus to developed being. -- Hodin of Gideon, "The Mark of Gideon", stardate 5423.4 From klappnase at web.de Tue Jun 18 17:21:29 2019 From: klappnase at web.de (Michael Lange) Date: Tue, 18 Jun 2019 23:21:29 +0200 Subject: [Tkinter-discuss] Text to postscript In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E0288FF6138@CERNXCHG51.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E0288FF43B2@CERNXCHG51.cern.ch> <20190618111612.189575d9e079d6a1f0b1f116@web.de> <0BC70B5D93E054469872FFD0FE07220E0288FF6138@CERNXCHG51.cern.ch> Message-ID: <20190618232129.3f256c962772507b1c8eaf96@web.de> Hi, On Tue, 18 Jun 2019 10:09:08 +0000 Vasilis Vlachoudis wrote: > Thanks Michael, > > not exactly what I was looking for. oh yes, I thought so :) > I am investigating how difficult is to write my own ps exporter, > based on the Canvas postscript source code. This would surely be awesome! In case you succeed please make sure to let us know :) Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. "What terrible way to die." "There are no good ways." -- Sulu and Kirk, "That Which Survives", stardate unknown From Cameron at phaseit.net Wed Jun 19 09:52:06 2019 From: Cameron at phaseit.net (Cameron Laird) Date: Wed, 19 Jun 2019 13:52:06 +0000 Subject: [Tkinter-discuss] Text to postscript In-Reply-To: <20190618232129.3f256c962772507b1c8eaf96@web.de> References: <0BC70B5D93E054469872FFD0FE07220E0288FF43B2@CERNXCHG51.cern.ch> <20190618111612.189575d9e079d6a1f0b1f116@web.de> <0BC70B5D93E054469872FFD0FE07220E0288FF6138@CERNXCHG51.cern.ch> <20190618232129.3f256c962772507b1c8eaf96@web.de> Message-ID: <20190619135206.GA22013@lairds.us> On Tue, Jun 18, 2019 at 11:21:29PM +0200, Michael Lange wrote: . . . > On Tue, 18 Jun 2019 10:09:08 +0000 > Vasilis Vlachoudis wrote: > > > Thanks Michael, > > > > not exactly what I was looking for. > > oh yes, I thought so :) > > > I am investigating how difficult is to write my own ps exporter, > > based on the Canvas postscript source code. > > This would surely be awesome! In case you succeed please make sure to let > us know :) . . . I've written such before. More precisely, I composed several PostScript utilities and programs, including one exporter from a custom Tk Canvas. I remember it as being fun and rewarding. While I'm overbooked at the present, I can at least say that a similar project for Tkinter certainly *sounds* feasible. From bob at passcal.nmt.edu Wed Jun 19 13:55:23 2019 From: bob at passcal.nmt.edu (bob) Date: Wed, 19 Jun 2019 11:55:23 -0600 Subject: [Tkinter-discuss] Tcl/Tk/Tkinter now in macOS Pythons Message-ID: <822AB086-BDBF-491B-8E5D-2CFB89B6B091@passcal.nmt.edu> So with recent versions of the Python 2 and 3 installers for macOS the Python.org (not .com! :) have started including their own private copy of Tcl/Tk (8.6.8) and 'import Tkinter/tkinter' works right out of the box. What does that mean? Is Tkinter going to be pushed back up the popularity ladder? Every one else at work uses PyQT or even wxPython. I don't care for the look or feel or coding of either one. Unfortunately, this Tkinter still doesn't work right under 2 or 3. Example: from Tkinter (or tkinter) import * Root = Tk() B = Button(Root, text = "test") B.pack() B.config(bg = "red") The background doesn't change color and the whole interface is Aqua-like with rounded bad looking buttons and white on white backgrounds, instead of X11/Linux square-corner buttons and shades of grey backgrounds. Is there a chance of that being fixed now that it's all included? There is other GUI funny business too. We started compiling our own versions of Python for Macs (and Linux, Sun) a long time ago and our Tkinter programs fire up XQuartz on Macs to get that Linux look and feel. I wonder if there is something simple that can be set for these new versions to get a better renderer? It might be within XQuartz. When you install it there is a message about needing to log out and back in to make it your default X11 server, but, of course, that doesn't help. XQuartz hasn't changed since 2016, but seems to be fine on Mojave. From kw at codebykevin.com Wed Jun 19 16:08:30 2019 From: kw at codebykevin.com (Codebykevin) Date: Wed, 19 Jun 2019 16:08:30 -0400 Subject: [Tkinter-discuss] Tcl/Tk/Tkinter now in macOS Pythons In-Reply-To: <822AB086-BDBF-491B-8E5D-2CFB89B6B091@passcal.nmt.edu> References: <822AB086-BDBF-491B-8E5D-2CFB89B6B091@passcal.nmt.edu> Message-ID: <0F33B9F5-B8FF-4DBC-B97A-D96F577143A7@codebykevin.com> The bundled Tcl/Tk is native, not X11. That?s a feature, not a bug. > On Jun 19, 2019, at 1:55 PM, bob wrote: > > So with recent versions of the Python 2 and 3 installers for macOS the Python.org (not .com! :) have started including their own private copy of Tcl/Tk (8.6.8) and 'import Tkinter/tkinter' works right out of the box. What does that mean? Is Tkinter going to be pushed back up the popularity ladder? Every one else at work uses PyQT or even wxPython. I don't care for the look or feel or coding of either one. Unfortunately, this Tkinter still doesn't work right under 2 or 3. Example: > > from Tkinter (or tkinter) import * > Root = Tk() > B = Button(Root, text = "test") > B.pack() > B.config(bg = "red") > > The background doesn't change color and the whole interface is Aqua-like with rounded bad looking buttons and white on white backgrounds, instead of X11/Linux square-corner buttons and shades of grey backgrounds. Is there a chance of that being fixed now that it's all included? There is other GUI funny business too. We started compiling our own versions of Python for Macs (and Linux, Sun) a long time ago and our Tkinter programs fire up XQuartz on Macs to get that Linux look and feel. I wonder if there is something simple that can be set for these new versions to get a better renderer? It might be within XQuartz. When you install it there is a message about needing to log out and back in to make it your default X11 server, but, of course, that doesn't help. XQuartz hasn't changed since 2016, but seems to be fine on Mojave. > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > https://mail.python.org/mailman/listinfo/tkinter-discuss > From Cameron at phaseit.net Fri Jun 21 04:59:41 2019 From: Cameron at phaseit.net (Cameron Laird) Date: Fri, 21 Jun 2019 08:59:41 +0000 Subject: [Tkinter-discuss] Tcl/Tk/Tkinter now in macOS Pythons In-Reply-To: <822AB086-BDBF-491B-8E5D-2CFB89B6B091@passcal.nmt.edu> References: <822AB086-BDBF-491B-8E5D-2CFB89B6B091@passcal.nmt.edu> Message-ID: <20190621085941.GA2214@lairds.us> On Wed, Jun 19, 2019 at 11:55:23AM -0600, bob wrote: . . . > So with recent versions of the Python 2 and 3 installers for macOS the Python.org (not .com! :) have started including their own private copy of Tcl/Tk (8.6.8) and 'import Tkinter/tkinter' works right out of the box. What does that mean? Is Tkinter going to be pushed back up the popularity ladder? Every one else at work uses PyQT or even wxPython. I don't care for the look or feel or coding of either one. Unfortunately, this Tkinter still doesn't work right under 2 or 3. Example: > > from Tkinter (or tkinter) import * > Root = Tk() > B = Button(Root, text = "test") > B.pack() > B.config(bg = "red") > > The background doesn't change color and the whole interface is Aqua-like with rounded bad looking buttons and white on white backgrounds, instead of X11/Linux square-corner buttons and shades of grey backgrounds. Is there a chance of that being fixed now that it's all included? There is other GUI funny business too. We started compiling our own versions of Python for Macs (and Linux, Sun) a long time ago and our Tkinter programs fire up XQuartz on Macs to get that Linux look and feel. I wonder if there is something simple that can be set for these new versions to get a better renderer? It might be within XQuartz. When you install it there is a message about needing to log out and back in to make it your default X11 server, but, of course, that doesn't help. XQuartz hasn't changed since 2016, but seems to be fine on Mojave. . . . I'm willing to sacrifice Python 2 at this point. Does *that* help? From Vasilis.Vlachoudis at cern.ch Mon Jun 24 08:31:53 2019 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Mon, 24 Jun 2019 12:31:53 +0000 Subject: [Tkinter-discuss] Text to postscript In-Reply-To: <20190619135206.GA22013@lairds.us> References: <0BC70B5D93E054469872FFD0FE07220E0288FF43B2@CERNXCHG51.cern.ch> <20190618111612.189575d9e079d6a1f0b1f116@web.de> <0BC70B5D93E054469872FFD0FE07220E0288FF6138@CERNXCHG51.cern.ch> <20190618232129.3f256c962772507b1c8eaf96@web.de>, <20190619135206.GA22013@lairds.us> Message-ID: <0BC70B5D93E054469872FFD0FE07220E0288FFAC5B@CERNXCHG51.cern.ch> Hi all, last weekend I started working on an initial version of the Text() -> postscript exporter. Still is very primitive but some basic functionality is there. Who ever is interested (or propose changes), can find it on https://github.com/vlachoudis/pstext run with "python3 pstext.py" (Sorry it executes the "gv" command to visualize the postscript in linux. I don't know how to do it in windows or on mac) (After 1s it opens the gv viewer, or you can trigger it with the "v" keyboard command, "q" to quit) Needless to say I am completely newbie in postscript, so maybe a few things might be done in a wrong way. The program is using the "Text.dump()" command to go through all the Text() content and convert it to postscript. However I have a list of problems some related to tk and some with postscript Tk related: 1. I could not find a way to get the "image" data from an embeded image in the Text() widget 2. When word wrap is enabled how I can find where is the "word break" on each line? Tk-Postscript related: 1. How to make a proper "font" mapping from x11 to postscript 2. Unicode text: I have no idea how to do it in postscript. 3. How to get from postscript the font information (height, ascending, descending etc...) when running in python? I was thinking that the best way will be to "subclass" the Text and add a "postscript" method maybe like in the Canvas that returns a text object, but for starting I preferred to make it external. Any comments, suggestions are more than welcome Vasilis ________________________________________ From: Tkinter-discuss [tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org] on behalf of Cameron Laird [Cameron at phaseit.net] Sent: Wednesday, June 19, 2019 15:52 To: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] Text to postscript On Tue, Jun 18, 2019 at 11:21:29PM +0200, Michael Lange wrote: . . . > On Tue, 18 Jun 2019 10:09:08 +0000 > Vasilis Vlachoudis wrote: > > > Thanks Michael, > > > > not exactly what I was looking for. > > oh yes, I thought so :) > > > I am investigating how difficult is to write my own ps exporter, > > based on the Canvas postscript source code. > > This would surely be awesome! In case you succeed please make sure to let > us know :) . . . I've written such before. More precisely, I composed several PostScript utilities and programs, including one exporter from a custom Tk Canvas. I remember it as being fun and rewarding. While I'm overbooked at the present, I can at least say that a similar project for Tkinter certainly *sounds* feasible. _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org https://mail.python.org/mailman/listinfo/tkinter-discuss