On 31/08/11 18:17, Susana Iraiis Delgado Rodriguez wrote:
Hello list !!
I'm developing a Python GUI application. I alreday developed a very
simple window with buttons, each button will do a different task, but
the most important button will need to get information gotten in
previous python's functions. Let's say I have four functions but at the
end I want to collet all the information gotten.

Instead of (or as well as) printing the data you will need to store it in variables. Then you can use those variables in the other function.


from Tkinter import *
import tkSimpleDialog
import tkMessageBox
import tkFileDialog

# define storage variables
dir = ""
extn = ""
csv_name = ""

def directorio():
    global dir    # need to specify the global one

  print 'Seleccione directorio donde empezar'
  dirname = > tkFileDialog.askdirectory(parent=root,
                   initialdir="/",
                   title='Selecciona > la ruta a escanear')
  if len(dirname ) > 0:
   print "You chose %s" % dirname

     dir = dirname  # store the value

def extension():
    global extn
  print "Escribe la extension que necesitas buscar"
  ext=tkSimpleDialog.askstring('Extension a buscar:','')
  print 'Buscando archivos: ',ext
    extn = ext

def csv():
    global csv_name
  print "Nombre del csv a crear"
  inv=tkSimpleDialog.askstring('Nombre de .csv:','')
  print 'Archivo de salida: ',inv
    csv_name = inv

def boton4():
#In this button I want to make a bigger process, but I need the root
selected and the two strings the user types.
  print csv.inv #Obviously this throws an error

    print dir,csv_name,extn

But course in a GUI you would normally not use print but instead populate the text field of a label or Text widget or some such
device.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to