[Tkinter-discuss] How to open a file from Tkinter window?

Michael O'Donnell michael.odonnell at uam.es
Sat Dec 19 23:44:20 CET 2009


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 <marsuc666 at 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 at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>


More information about the Tkinter-discuss mailing list