How to enable Load option in tkinter -python

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yorlina007
    New Member
    • Jun 2008
    • 2

    How to enable Load option in tkinter -python

    Hi

    I need to design a tkinter widget where i should have a browse option button as you see in all windows application to select a file from my machine.
    Also i need to select an integer from some dropdown box.
    How can i implement this... I m donewith the backend python coding.. but i need help for the front end..

    I tried using the code which i got from google..

    its like

    from ViewerFramework .gui import InputFormDescr
    from ViewerFramework .customizedWidg ets import SaveButton
    idf = InputFormDescr( title = 'SaveButton')

    #button description
    buttonwcfg = {'text':'Save', 'bg':'Red',
    'fg':'Black','b orderwidth':5}

    idf.append({'wi dgetType':SaveB utton,
    'name':'save',
    'wcfg':{'button Type':Tkinter.B utton,
    'title':'Save In File ...',
    'types':[('All Files','*.*'),
    ('Python Files','*.py')],
    'widgetwcfg':bu ttonwcfg},
    'gridcfg':{} })
    val = self.vf.getUser Input(idf)

    But i am am getting error like

    "ImportErro r: No module named ViewerFramework .gui"


    i m not sure how this progrm works...
    please help me in coding these...


    Thanks,
    Anil Roy
  • jlm699
    Contributor
    • Jul 2007
    • 314

    #2
    Those classes you are trying to import of part of a package distributed by this MGL Tools website. Click the download link on the left of the page to get the MGLtools package, which includes what you need.

    Also make sure you have Tkinter.

    Comment

    • dazzler
      New Member
      • Nov 2007
      • 75

      #3
      Originally posted by yorlina007
      Hi

      I need to design a tkinter widget where i should have a browse option button as you see in all windows application to select a file from my machine.
      Just use Tkinter's filedialog =)
      google tkFileDialog for more dialog types

      [code=python]
      import tkFileDialog

      path_name = tkFileDialog.as ksaveasfilename (title="Save File", filetypes=[("Python Files",".py"),( "All Files",".*")])

      print "in the code, save your file to", path_name[/code]

      Comment

      Working...