Hello,

My first attenpt at a simple  python Tkinter application. I wanted to
see how to load file names into a listbox from a menu. This is what I
got until the part of displaying the file names in a listbox, which I
could not figfure out how to do?

Any help would be appreciated. Trying to do this as simple as possible
to understand.

The "print fileNames" does work but how to display it in listbox?

from Tkinter import *
from tkFileDialog   import askopenfilenames

class MyCode:
   def __init__(self):
      root = Tk()
      
      menubar = Menu(root)
      filemenu = Menu(menubar)
      
      lbox = Listbox(root, width=50).pack()
      
      menubar.add_cascade(label='File', menu=filemenu)
      filemenu.add_command(label='New Project')
      filemenu.add_command(label='Load Files...', command=self.OnLoad)
      

      filemenu.add_command(label='Exit', command=root.quit)
      
      root.config(menu=menubar)
      
      root.mainloop()
      
      
   def OnLoad(self):
      fileNames = askopenfilenames(filetypes=[('Split Files', '*')])
      print fileNames

      
myApp = MyCode()
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to