I don't use classes much (mainly because I'm stupid), but I'd like to make a 
subclass of the regular Tkinter Button widget that simply adds spaces to the 
passed "text=" when the program is running on Windows (Linux, Solaris, Mac 
add a little space between the button text and the right and left edges of a 
button, Windows does not and it looks bad/can be hard to read).  Below is 
some pseudo code.  What should the guts of the BButton class be?  I can't 
work out how all of the arguments that would be passed to a regular Button 
call get handled.  *args and **kw confuse me and I can't seem to find simple 
enough examples in my mountain of books.

Thanks!

Bob


System = platform[:3].lower()
.
.
class BButton(Button):
    if System == "win":
        Make a button with " " before and after text
    else:
        Make a button using the passed text as is
.
.
BButton(Sub, text = "Hello", bg = "blue", fg = "yellow").pack(side = TOP)
BButton(Sub, bg = "yellow", bg = "blue", text = "World").pack(side = TOP)


On "lin", "sun", "dar":
    [Hello]
    [World]

On "win":
    [ Hello ]
    [ World ]


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

Reply via email to