On Dec 31, 2007 6:26 PM, Amit Finkler <[EMAIL PROTECTED]> wrote:
> Hi,
>
>
> I'm building a GUI for my system using Tkinter. I created the following
> Entry and Label widgets:
>
>
> from Tkinter import *
>
>
> win = Tk()
>
> f2 = Frame(win, bd = 2, relief = 'groove')
>
>
> Lake_adr = StringVar()
>
> LakeAdr = Entry(f2, textvariable = Lake_adr)
>
> LakeAdrLabel = Label(f2, text = 'Lakeshore address')
>
>
> LakeAdr.grid(row = 1, column = 0)
> LakeAdrLabel.grid(row = 0, column = 0)
>
>
> f2.pack()
>
>
> What I want to do is to have a default value already appearing in this
> entry widget, which other functions can take using something like
>
>
Hi Amit,
just call the set method of StringVar with the default value before you use
it. Like below
from Tkinter import*
win= Tk()
f2= Frame(win, bd = 2, relief = 'groove')
Lake_adr = StringVar()
Lake_adr.set("123")
LakeAdr = Entry(f2, textvariable = Lake_adr)
LakeAdrLabel = Label(f2, text = 'Lakeshore address')
LakeAdr.grid(row= 1, column = 0)
LakeAdrLabel.grid(row = 0, column = 0)
f2.pack()
How ever if you are only dealing with integers you can use IntVar
--
Godson Gera,
http://godson.in
_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss