Hi, The code you gave me is ok, but I would like to open files from such programs: (I'm Slovenian, don't get confused by strange names)
from Tkinter import * from math import * def izracunaj(): po=float(vnos.get()) v=float(vnos1.get()) P=(2*pi*po*po)+(2*pi*po*v) V=pi*po*po*v r.set(str(P)) re.set(str(V)) okno = Tk() okno.title("Valj") radij = Label(okno, text="r=") radij.grid(row=0, column=0, sticky=W) visina = Label(okno, text="v=") visina.grid(row=1, column=0, sticky=W) ploscina = Label(okno, text="P=") ploscina.grid(row=2, column=0, sticky=W) volumen = Label(okno, text="V=") volumen.grid(row=3, column=0, sticky=W) vnos=Entry(okno) vnos.grid(row=0, column=1) vnos1=Entry(okno) vnos1.grid(row=1, column=1) r=StringVar() re=StringVar() rezultat=Label(okno, textvariable=r) rezultat.grid(row=2, column=1) rezultat1=Label(okno, textvariable=re) rezultat1.grid(row=3, column=1) gumb=Button(okno, text=u"Izracunaj!", command=izracunaj) gumb.grid(row=4, column=1) w=LabelFrame(okno, text="Valji") w.grid(row=5, column=0) okno.mainloop() This is one of my programs, others are similar and I would like to open them on a way that another window would open as I press the button. The code you gave me switches between already existing windows, but how do I open a certain file with a button (in this case another program)? Marsel Mick O'Donnell wrote: > > Hi Marsel, > > The following code allows you to use buttons > on one window to bring another window to the top: > > from Tkinter import * > > windows=dict() > windows[1]=Toplevel() > windows[2]=Toplevel() > windows[3]=Toplevel() > > for wid1 in (1,2,3): > windows[wid1].title("Window "+str(wid1)) > windows[wid1].minsize(width=280, height=20) > fr=Frame(windows[wid1]) > fr.pack(side=TOP) > for wid2 in (1,2,3): > > if wid1==wid2: continue > Button(fr, text=str(wid2), > command=lambda w=windows[wid2]: > w.focus_set()).pack(side=LEFT) > > Is that what you wanted? > > You also say: >> So how can I "connect" or open files from inside a program? > > Is this a different question? I thought you were talking about > connecting windows? > > Mick > > On Sat, Dec 19, 2009 at 10:26 PM, Marsel <marsuc...@gmail.com> wrote: >> >> Hi, >> I'm new in python and I'm not very familiar with a lot of stuff, so >> please >> answer as simple as possible if you will :). >> >> The thing is, I would like to make connection betwen a few windows, in >> this >> case calculating programs, so I could open any of them from one window or >> just switch between them in tab - style. >> I'we also been trying to do it with a button, but in every case I've run >> out >> of ideas... I was looking for information everywhere, but as I've said, I >> don't understand most of the python expressions and was unable to find >> anything useful... >> >> So how can I "connect" or open files from inside a program? >> >> Any help would appreciated, >> >> thank you. >> -- >> View this message in context: >> http://old.nabble.com/How-to-open-a-file-from-Tkinter-window--tp26858702p26858702.html >> Sent from the Python - tkinter-discuss mailing list archive at >> Nabble.com. >> >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss@python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss@python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > -- View this message in context: http://old.nabble.com/How-to-open-a-file-from-Tkinter-window--tp26858702p26861922.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss