pickAFile Question!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • s34n23
    New Member
    • Feb 2013
    • 2

    pickAFile Question!

    How would I make it that if I opened pickAFile, that if cancel is pressed in the pickAFile() dialogue box, I want to ask the user if it was a mistake. If it was a mistake, open the pickAFile() dialogue again, and repeat until it is either not a mistake, or a picture file was selected.

    Thanks so much in advance!

    I have this down, it's not much but its a start...

    Code:
    def exampleA():
      file = pickAFile() 
      picture = makePicture(file)
      show(picture)
    Last edited by Niheel; Feb 28 '13, 04:45 AM. Reason: good to display code with question
  • dwblas
    Recognized Expert Contributor
    • May 2008
    • 626

    #2
    What does pickAFile return when cancel is pressed? If it is None then you can use something like
    Code:
    def exampleA():
        mistake = True
        while mistake:
            file = pickAFile() 
            if file==None:
                mistake=ask_if_mistake() ## returns True or False
            else:
                picture = makePicture(file)
                show(picture)
                mistake=False

    Comment

    • s34n23
      New Member
      • Feb 2013
      • 2

      #3
      If a picture file is selected, I want it to return the 'made' picture, otherwise if cancel was pushed and the user indicated that it was NOT a mistake to return an error message.

      Comment

      Working...