[Tutor] Tk question

Rick Pasotto rickp@telocity.com
Tue, 11 Jun 2002 13:44:07 -0400


Add a justify option to your call to Label():

Sub = Label(Master, font='fixed', text=out, justify=LEFT)

On Tue, Jun 11, 2002 at 06:58:05PM +0530, lonetwin_SubD wrote:
> Hi ppl,
>      For convenience sake, I wrote a wrapper around the 'cal' command on my 
> linux box (and bound it to a shortcut keystroke on my Window manager). There 
> is one problem tho', I just can't figure out how to get the first and last 
> lines aligned properly. I tried passing anchor="w" while initialising the 
> Label but that does not seem to help .....any pointers ??
> 
> Here's the code (maybe someone else might find it useful too :)). 
> 
> Note : I specifically set the font to "fixed" b'cos with variable width fonts 
> spaces are "thinner" than characters and that screws up the display.
> 
> ---------------------------------------
> #!/usr/bin/python
> import os
> 
> cal="/usr/bin/cal.orig"
> args = ''.join(os.sys.argv[1:])
> out = os.popen('%s %s' % (cal, args)).read()
> 
> if os.environ.has_key('DISPLAY'):
> 	from Tkinter import *
> 	Master = Frame()
> 	Master.master.title("Tkcal")
> 	Sub = Label(Master, font='fixed', text=out)
> 	Master.grid(ipadx=2, ipady=2)
> 	Sub.grid()
> 	Master.mainloop()
> else:
> 	print out
> ----------------------------------------
> 
> Peace
> Steve
> 
> PS: Maybe you are wondering why I did this, well I can only say that I find 
> myself using the keyboard 95% of the time when in windowmaker (my preferred 
> wm). Also, I've got a similar (shortcut) "front-end" to "ispell -a", I'll 
> send it across if anybody is interested.
> 
> -- 
> The prettiest women are almost always the most boring, and that is why
> some people feel there is no God.
> 		-- Woody Allen, "Without Feathers"
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 

-- 
"Life is like an over long drama through which we sit being nagged
by the vague memories of having read the reviews."
		-- John Updike
    Rick Pasotto    rickp@telocity.com    http://www.niof.net