From Vasilis.Vlachoudis at cern.ch Mon Jan 6 04:40:42 2020 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Mon, 6 Jan 2020 09:40:42 +0000 Subject: [Tkinter-discuss] wait_window exception In-Reply-To: <20191227082038.7c3b1479902d9a8b762a1185@web.de> References: <0BC70B5D93E054469872FFD0FE07220E02E64565D0@CERNXCHG53.cern.ch> <20191224135942.a80b36f9dcbb19075cc3e965@web.de> <0BC70B5D93E054469872FFD0FE07220E02E645B288@CERNXCHG53.cern.ch>, <20191227082038.7c3b1479902d9a8b762a1185@web.de> Message-ID: <0BC70B5D93E054469872FFD0FE07220E02E6461D12@CERNXCHG53.cern.ch> Happy new decade everyone! Interesting enough, removing the "deiconify()" the problem didn't reoccur. Maybe, not enough people test it, but I am happy that works on windows, linux and mac for the moment without the problem. Vasilis ________________________________________ From: Michael Lange [klappnase at web.de] Sent: Friday, December 27, 2019 08:20 To: Vasilis Vlachoudis Cc: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] wait_window exception Hi, On Wed, 25 Dec 2019 17:04:04 +0000 Vasilis Vlachoudis wrote: > Thanks Michael > my best wishes to you too. > The close method is the following, apart some bookkeeping nothing > special. > # ---------------------------------------------------------------------- > def close(self): > FileDialog._active = False > FileDialog.width = self.winfo_width() > FileDialog.height = self.winfo_height() > FileDialog.sash = [self.fileList.paneframe.sash_coord > (i)[0] for i in range(len(self.fileList.listboxes())-1)] > tkExtra.ExListbox.resetSearch() > self.grab_release() > self.destroy() > > I've realized that the "deiconify()" was creating some problems on > Windows, so I removed it, and it seems it works better. When I will > deploy this version I will know after if it still generates problems. it seems rather odd if actually deiconify() is the culprit here. Another thought that occurred to me, is the window path name ".!flair.! configdialog3.!opendialog\" assigned manually? If yes, is it possible that a second window that tries to go by the same path name interferes here? Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. If some day we are defeated, well, war has its fortunes, good and bad. -- Commander Kor, "Errand of Mercy", stardate 3201.7 From klappnase at web.de Mon Jan 6 07:50:58 2020 From: klappnase at web.de (Michael Lange) Date: Mon, 6 Jan 2020 13:50:58 +0100 Subject: [Tkinter-discuss] wait_window exception In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E02E6461D12@CERNXCHG53.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E02E64565D0@CERNXCHG53.cern.ch> <20191224135942.a80b36f9dcbb19075cc3e965@web.de> <0BC70B5D93E054469872FFD0FE07220E02E645B288@CERNXCHG53.cern.ch> <20191227082038.7c3b1479902d9a8b762a1185@web.de> <0BC70B5D93E054469872FFD0FE07220E02E6461D12@CERNXCHG53.cern.ch> Message-ID: <20200106135058.44d3e950562600077907219a@web.de> Hi, On Mon, 6 Jan 2020 09:40:42 +0000 Vasilis Vlachoudis wrote: > Happy new decade everyone! > > Interesting enough, removing the "deiconify()" the problem didn't > reoccur. Maybe, not enough people test it, but I am happy that works on > windows, linux and mac for the moment without the problem. I am glad you finally got it working. Now when I look at your original post it seems there hasn't been a call to withdraw() first, maybe this was the problem? Otherwise it still would seem odd to me. Best regards, and a happy new year (or decade :) to all of you! Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Actual war is a very messy business. Very, very messy business. -- Kirk, "A Taste of Armageddon", stardate 3193.0 From homeofmars at gmail.com Sun Jan 5 08:53:25 2020 From: homeofmars at gmail.com (Ramprasad S) Date: Sun, 5 Jan 2020 19:23:25 +0530 Subject: [Tkinter-discuss] Unicode Displays Incorrectly in tkinter - Help Message-ID: Hello Folks, Can any of you help me with the question below? All the details of my code and the issue I am facing is documented here. It would be great if the people in this list can help me out here. https://stackoverflow.com/questions/59512272/unicode-displays-incorrectly-in-tkinter Regards, Ram -------------- next part -------------- An HTML attachment was scrubbed... URL: From Vasilis.Vlachoudis at cern.ch Thu Jan 16 08:14:08 2020 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Thu, 16 Jan 2020 13:14:08 +0000 Subject: [Tkinter-discuss] horizontal line in Text Message-ID: <0BC70B5D93E054469872FFD0FE07220E02E6465A58@CERNXCHG53.cern.ch> Hi all, is it possible to draw a horizontal line in the Text() widget, something like the
in html, extending all over the widget. Vasilis -------------- next part -------------- An HTML attachment was scrubbed... URL: From klappnase at web.de Thu Jan 16 11:56:46 2020 From: klappnase at web.de (Michael Lange) Date: Thu, 16 Jan 2020 17:56:46 +0100 Subject: [Tkinter-discuss] horizontal line in Text In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E02E6465A58@CERNXCHG53.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E02E6465A58@CERNXCHG53.cern.ch> Message-ID: <20200116175646.eb9dfd5c01e59d85d1358691@web.de> Hi, On Thu, 16 Jan 2020 13:14:08 +0000 Vasilis Vlachoudis wrote: > Hi all, > > is it possible to draw a horizontal line in the Text() widget, something > like the
in html, extending all over the widget. I have done this before with an embedded Frame widget, however changes to the Text widget size have to be taken into account and the Frame widgets need to be resized accordingly, which makes things a bit complicated. Maybe there is a simpler way to do that, but I don't know any. I'll post the important parts of the code I used below. I hope this helps :) Michael ################################################################ def send_hor_rule(self, *args): xoff = int(self.text['highlightthickness']) + \ int(self.text['bd']) + int(self.text['padx']) + 15 # 15 px. extra padding w = self.text.winfo_width() - 2 * xoff f = tkinter.Frame(self.text, height=4, highlightthickness=0, width=w, relief='ridge', bd=2, bg='gray60') i = self.text.index('insert') self.text.window_create('insert', window=f, align='center') self.text.horRules.append((i, f)) def _configureHorRules(self, *event): # callback for Configure events if self.text.horRules: # _getMaxLineSize() is slow, but calling it on every Configure # event seems to be the only way to make this work reliably maxlinesize = self._getMaxLineSize() w = self.text.winfo_width() xoff = int(self.text['highlightthickness']) + \ int(self.text['bd']) + int(self.text['padx']) w_vis = w - 2 * xoff m = max((w_vis, maxlinesize)) for (i, w) in self.text.horRules: w.configure(width=m) return def _getMaxLineSize(self, *event): # calculate the max. required size of a line to use as size # for the horizontal rules numlines = self.text.count('1.0', 'end', 'lines') or 0 xpixmax = 0 if numlines: numlines = numlines[0] horRuleLines = [ int(i.split('.')[0]) for (i, w) in self.text.horRules] for i in range(1, numlines + 1): if i in horRuleLines: # if a line with a horRule is the biggest, the hor. rule # might get bigger with each reconfiguring, so we must # not take these lines into account continue xpix = self.text.count( '%d.0' % i, '%d.0 lineend' % i, 'xpixels') if xpix and xpix[0] > xpixmax: xpixmax = xpix[0] return xpixmax ############################################################### .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. The sooner our happiness together begins, the longer it will last. -- Miramanee, "The Paradise Syndrome", stardate 4842.6 From Vasilis.Vlachoudis at cern.ch Thu Jan 16 13:39:14 2020 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Thu, 16 Jan 2020 18:39:14 +0000 Subject: [Tkinter-discuss] horizontal line in Text In-Reply-To: <20200116175646.eb9dfd5c01e59d85d1358691@web.de> References: <0BC70B5D93E054469872FFD0FE07220E02E6465A58@CERNXCHG53.cern.ch>, <20200116175646.eb9dfd5c01e59d85d1358691@web.de> Message-ID: <0BC70B5D93E054469872FFD0FE07220E02E6465D70@CERNXCHG53.cern.ch> Thanks Michael, I will give it a try 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, January 16, 2020 17:56 To: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] horizontal line in Text Hi, On Thu, 16 Jan 2020 13:14:08 +0000 Vasilis Vlachoudis wrote: > Hi all, > > is it possible to draw a horizontal line in the Text() widget, something > like the
in html, extending all over the widget. I have done this before with an embedded Frame widget, however changes to the Text widget size have to be taken into account and the Frame widgets need to be resized accordingly, which makes things a bit complicated. Maybe there is a simpler way to do that, but I don't know any. I'll post the important parts of the code I used below. I hope this helps :) Michael ################################################################ def send_hor_rule(self, *args): xoff = int(self.text['highlightthickness']) + \ int(self.text['bd']) + int(self.text['padx']) + 15 # 15 px. extra padding w = self.text.winfo_width() - 2 * xoff f = tkinter.Frame(self.text, height=4, highlightthickness=0, width=w, relief='ridge', bd=2, bg='gray60') i = self.text.index('insert') self.text.window_create('insert', window=f, align='center') self.text.horRules.append((i, f)) def _configureHorRules(self, *event): # callback for Configure events if self.text.horRules: # _getMaxLineSize() is slow, but calling it on every Configure # event seems to be the only way to make this work reliably maxlinesize = self._getMaxLineSize() w = self.text.winfo_width() xoff = int(self.text['highlightthickness']) + \ int(self.text['bd']) + int(self.text['padx']) w_vis = w - 2 * xoff m = max((w_vis, maxlinesize)) for (i, w) in self.text.horRules: w.configure(width=m) return def _getMaxLineSize(self, *event): # calculate the max. required size of a line to use as size # for the horizontal rules numlines = self.text.count('1.0', 'end', 'lines') or 0 xpixmax = 0 if numlines: numlines = numlines[0] horRuleLines = [ int(i.split('.')[0]) for (i, w) in self.text.horRules] for i in range(1, numlines + 1): if i in horRuleLines: # if a line with a horRule is the biggest, the hor. rule # might get bigger with each reconfiguring, so we must # not take these lines into account continue xpix = self.text.count( '%d.0' % i, '%d.0 lineend' % i, 'xpixels') if xpix and xpix[0] > xpixmax: xpixmax = xpix[0] return xpixmax ############################################################### .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. The sooner our happiness together begins, the longer it will last. -- Miramanee, "The Paradise Syndrome", stardate 4842.6 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org https://mail.python.org/mailman/listinfo/tkinter-discuss From aivar.annamaa at gmail.com Thu Jan 16 14:27:21 2020 From: aivar.annamaa at gmail.com (Aivar Annamaa) Date: Thu, 16 Jan 2020 21:27:21 +0200 Subject: [Tkinter-discuss] horizontal line in Text In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E02E6465A58@CERNXCHG53.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E02E6465A58@CERNXCHG53.cern.ch> Message-ID: <4c596212-ce8e-6507-895a-492ead306ee3@gmail.com> You can try using bgstipple attribute of a tag (https://www.tcl.tk/man/tcl8.6/TkCmd/text.htm#M45): text.tag_configure(tag_name, bgstipple="@path/to/a/bitmap/containing/a/line.xbm") but unfortunately it doesn't work on macOS (https://wiki.tcl-lang.org/page/Tk+differences+on+Mac+OS+X) Best regards, Aivar On 16.01.2020 15:14, Vasilis Vlachoudis wrote: > Hi all, > > is it possible to draw a horizontal line in the Text() widget, something > like the
in html, extending all over the widget. > > Vasilis > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > https://mail.python.org/mailman/listinfo/tkinter-discuss -------------- next part -------------- An HTML attachment was scrubbed... URL: From alan.gauld at yahoo.co.uk Thu Jan 23 19:18:20 2020 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Fri, 24 Jan 2020 00:18:20 +0000 Subject: [Tkinter-discuss] horizontal line in Text In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E02E6465A58@CERNXCHG53.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E02E6465A58@CERNXCHG53.cern.ch> Message-ID: On 16/01/2020 13:14, Vasilis Vlachoudis wrote: > Hi all, > > is it possible to draw a horizontal line in the Text() widget, something > like the
in html, extending all over the widget. Would a line of spaces with the underline turned on in the font work? If you use a monospace font the length should be fairly predictable. Just a thought. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos From klappnase at web.de Fri Jan 24 04:15:16 2020 From: klappnase at web.de (Michael Lange) Date: Fri, 24 Jan 2020 10:15:16 +0100 Subject: [Tkinter-discuss] horizontal line in Text In-Reply-To: References: <0BC70B5D93E054469872FFD0FE07220E02E6465A58@CERNXCHG53.cern.ch> Message-ID: <20200124101516.00c6b41aec39a447f491d6bb@web.de> Hi, On Fri, 24 Jan 2020 00:18:20 +0000 Alan Gauld via Tkinter-discuss wrote: > On 16/01/2020 13:14, Vasilis Vlachoudis wrote: > > Hi all, > > > > is it possible to draw a horizontal line in the Text() widget, > > something like the
in html, extending all over the widget. > > Would a line of spaces with the underline turned on in the font work? > If you use a monospace font the length should be fairly predictable. > > Just a thought. I think the problem with all text based solutions is that these "lines" will not resize along with the text widget and worse, might line-break when the widget size is being reduced. 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 alan.gauld at yahoo.co.uk Fri Jan 24 07:19:21 2020 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Fri, 24 Jan 2020 12:19:21 +0000 Subject: [Tkinter-discuss] horizontal line in Text In-Reply-To: <20200124101516.00c6b41aec39a447f491d6bb@web.de> References: <0BC70B5D93E054469872FFD0FE07220E02E6465A58@CERNXCHG53.cern.ch> <20200124101516.00c6b41aec39a447f491d6bb@web.de> Message-ID: <5eced6fa-fbc5-75ab-6f03-557551bccf1f@yahoo.co.uk> On 24/01/2020 09:15, Michael Lange wrote: >>> is it possible to draw a horizontal line in the Text() widget, >>> something like the
in html, extending all over the widget. >> >> Would a line of spaces with the underline turned on in the font work? >> If you use a monospace font the length should be fairly predictable. >> >> Just a thought. > > I think the problem with all text based solutions is that these "lines" > will not resize along with the text widget and worse, might line-break > when the widget size is being reduced. Yeah, after I posted I had a bit of a think and tried a few things out. I came to the conclusion you really need a widget class that would handle all those kinds of things. The humble
tag has quite a lot of functionality when you start digging deeper. (size by absolute or percent, styles, thickness, etc) But if its just a divider in a text field, underline of overstrike might work as a casual fix. You could handle resize events if needed, but not much more. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos From Vasilis.Vlachoudis at cern.ch Fri Jan 24 11:44:30 2020 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Fri, 24 Jan 2020 16:44:30 +0000 Subject: [Tkinter-discuss] horizontal line in Text In-Reply-To: References: <0BC70B5D93E054469872FFD0FE07220E02E6465A58@CERNXCHG53.cern.ch>, Message-ID: <0BC70B5D93E054469872FFD0FE07220E02E6480E13@CERNXCHG51.cern.ch> Thanks That's the easiest from all, and for my purpose it works just fine Vasilis ________________________________ From: Bryan Oakley [bryan.oakley at gmail.com] Sent: Friday, January 24, 2020 16:04 To: Vasilis Vlachoudis Subject: Re: [Tkinter-discuss] horizontal line in Text What I've done in the past is insert a single newline, and then apply a tag that uses a one or two pixel tall font, and then a background color or a border. When you add a tag on a newline, the background and border is always drawn to the right margin and is adjusted as the window is resized, yielding what looks like a line. def insert_hr(text, index): text.tag_configure("hr", font=("Times", -2), background="red") text.insert(index, "\n", "hr") insert_hr(text, "2.0") This is what it looks like on my mac: [Screen Shot 2020-01-24 at 9.02.16 AM.png] On Thu, Jan 16, 2020 at 7:14 AM Vasilis Vlachoudis > wrote: Hi all, is it possible to draw a horizontal line in the Text() widget, something like the
in html, extending all over the widget. Vasilis _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org https://mail.python.org/mailman/listinfo/tkinter-discuss -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screen Shot 2020-01-24 at 9.02.16 AM.png Type: image/png Size: 34929 bytes Desc: Screen Shot 2020-01-24 at 9.02.16 AM.png URL: From klappnase at web.de Sun Jan 26 17:24:35 2020 From: klappnase at web.de (Michael Lange) Date: Sun, 26 Jan 2020 23:24:35 +0100 Subject: [Tkinter-discuss] horizontal line in Text In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E02E6480E13@CERNXCHG51.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E02E6465A58@CERNXCHG53.cern.ch> <0BC70B5D93E054469872FFD0FE07220E02E6480E13@CERNXCHG51.cern.ch> Message-ID: <20200126232435.fac2e7093081377269f851bf@web.de> Hi, On Fri, 24 Jan 2020 16:44:30 +0000 Vasilis Vlachoudis wrote: > Thanks > That's the easiest from all, and for my purpose it works just fine > > Vasilis > > > > ________________________________ > From: Bryan Oakley [bryan.oakley at gmail.com] > Sent: Friday, January 24, 2020 16:04 > To: Vasilis Vlachoudis > Subject: Re: [Tkinter-discuss] horizontal line in Text > > What I've done in the past is insert a single newline, and then apply a > tag that uses a one or two pixel tall font, and then a background color > or a border. When you add a tag on a newline, the background and border > is always drawn to the right margin and is adjusted as the window is > resized, yielding what looks like a line. > > def insert_hr(text, index): > text.tag_configure("hr", font=("Times", -2), background="red") > text.insert(index, "\n", "hr") > insert_hr(text, "2.0") thanks for sharing! You are right, this is much better than tinkering with embedded Frames. It never occured to me that this could be done so easily. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. A princess should not be afraid -- not with a brave knight to protect her. -- McCoy, "Shore Leave", stardate 3025.3