Re: [Tutor] Weird tkFont behavior
"Steve Willoughby" wrote I've been getting happier to see the improvements to what you can do with just plain Tkinter since the last time I used it seriously. I agree, Tkinter still gets a lot of bad feedback about its look but with ttk that's no longer justified. wxPython still has the edge for fully featured GUI work but for basic GUI work Tkinter/ttk is easier and works "out of the box" with most python installations. Alan G ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Weird tkFont behavior
On 17-Jun-11 14:18, Alan Gauld wrote: But I confess I've never used font tags (and didn't even know they existed). Neither did I until now. I had been playing with WxPython previously (which is still a great toolkit I'd recommend when it makes sense), but I've been getting happier to see the improvements to what you can do with just plain Tkinter since the last time I used it seriously. Tkinter and ttk do have the advantage of already being right there in the standard library. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Weird tkFont behavior
"Steve Willoughby" wrote I think I solved it, actually.. as I was typing this up, I wondered in passing about this: of the other fonts I configured for the other tags. Do I need to keep other references to the tkFont objects somewhere else or something? I was going to suggest trying that and if it didn't work to ask on the tkinter group, they are usually pretty responsive. But I confess I've never used font tags (and didn't even know they existed). Alan G. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Weird tkFont behavior
On 16-Jun-11 09:52, Steve Willoughby wrote: I'm probably just doing something stupid, but I can't spot the error. I hope someone here can see what I'm looking past, or knows of a known issue with these widgets. I think I solved it, actually.. as I was typing this up, I wondered in passing about this: of the other fonts I configured for the other tags. Do I need to keep other references to the tkFont objects somewhere else or something? and I think that was it. I recoded it so that I store the Font objects independently of the tag configuration call, in case they were getting destroyed accidentally somewhere (I know you have to do that with other Tk objects such as images), and now I can't get the app to fail. If interested, here's the new setup code: | f=Tkinter.Text(self, ...) | | self.font_tags = {} | for tag, weight, slant, others in ( |('rm', tkFont.NORMAL, tkFont.ROMAN, {}), |('bf', tkFont.BOLD, tkFont.ROMAN, {}), |('it', tkFont.NORMAL, tkFont.ITALIC, {}), |('bi', tkFont.BOLD, tkFont.ITALIC, {}), |('ref',tkFont.NORMAL, tkFont.ITALIC, {'foreground':'blue', 'underline':True}), | ): | self.font_tags[tag] = tkFont.Font(family='Helvetica', size=10, weight=weight, slant=slant) | f.tag_config(tag, font=self.font_tags[tag], **others) (Added "|" in the left column to hopefully get the text to indent right with some mail readers. That's not part of the code, of course.) -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor