Re: Idiots guide to fonts with tKinter

2005-08-04 Thread RangerElf
Well, all text classes in Tkinter can take a " font=(...) " argument to
specify the face with which to display, for example:

from tkinter import *

label = Label(root, font=("Helvetica", "bold", 13), ...)


It's been a while since I've played with Tkinter, so I might be a
little off on the exact syntax, but that's the main idea.  It's really
simple once you get the hang of it.

Regarding the text editor: it's an excellent idea.  By using Tkinter's
text widget you can get a bit of milage easily; you'll have to define
and use "tags" in order to organize your text styles, it'll make
everything quite a bit easier.

You can glean a bunch of info from Idle's sources.

Good luck :-)

-gus

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Make a small function thread safe

2011-12-18 Thread RangerElf
Which is why the original .acquire() ... .release() idiom was wrong, this would 
better express the intent:

try:
  lock.acquire()
  shared_container.append(...)
finally:
  lock.release()

But like everyone mentions, the with statement takes care of all that in a more 
readable and compact fashion.
-- 
http://mail.python.org/mailman/listinfo/python-list