[Tkinter-discuss] (no subject)

Devred, Emmanuel Emmanuel.Devred at dfo-mpo.gc.ca
Tue Sep 21 21:22:28 CEST 2010

I am a total beginner with python and tkinter and I am having a hard
time getting my program working, I think the problem come from passing
I would like to have a menu that would with three main buttons, the
first one (LUT) let me chosse between two files, the second button (rrs)
opens a browser to choose a file and the third button would run a
program (or function) that makes some computation between the two files
open with button 1 and button 2, 
Here is what I have written

from Tkinter import *
from tkFileDialog   import askopenfilename
import numpy as np

class openfile():
    def __init__(self, yn):
        if yn == 0 : self.lut =
        if yn == 1 : self.lut =
        if yn == 2 : filename =
        if yn == 2 : self.lut =

Class rrs_file(self,rrs):
    filename =
    rrs = np.loadtxt(filename,dtype=np.float,skiprows=1)
def make_comp():
    result = self.lut[1,2] * rrs[1,2]
    print result
def callback():
    print "called the callback!"

root = Tk()

# create a menu
menu = Menu(root)

filemenu = Menu(menu)
menu.add_cascade(label="LUT", menu=filemenu)
filemenu.add_command(label="East Pacific", command=lambda:openfile(0))
filemenu.add_command(label="NW Atlantic", command=lambda:openfile(1))

image_menu = Menu(menu)
menu.add_cascade(label="Rrs", command=rrs_file)

run_menu = Menu(menu)
menu.add_cascade(label="Run", command = make_comp)

quitmenu = Menu(menu)
menu.add_cascade(label="Quit", command=root.destroy)

#x = openfile(2)


I can not figure out how to pass get the lut and rrs parameters that I
have defined in the class objects?

I need help !!!

 Thank you very much in advance.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20100921/d6c73fdf/attachment.html>

More information about the Tkinter-discuss mailing list