OpenFileDialog Doesn't appear

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

OpenFileDialog Doesn't appear

srfpala
The attachment contains two programs written using PyScripter. 
The Open File Dialog (OFD)  works well in Program 1 but never appears
in Program 2.  I believe the OFD code is the same in both programs. 
Resulting errors are shown after Program 2.
Any ideas ?
TIA
  Bob

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

wx Users Forum.txt (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: OpenFileDialog Doesn't appear

Robin Dunn


On Wednesday, October 3, 2018 at 2:43:33 PM UTC-7, srfpala wrote:
The attachment contains two programs written using PyScripter. 
The Open File Dialog (OFD)  works well in Program 1 but never appears
in Program 2.  I believe the OFD code is the same in both programs. 
Resulting errors are shown after Program 2.
Any ideas ?


When you start the application you do this:

    frame = MyForm().Show()

Then when you create the file dialog you do this:

        openFileDialog = wx.FileDialog(frame, "Open", "", "",
                                      "Text files (*.txt)|*.txt",
                                       wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)

Can you now see why you get this error?:

TypeError: FileDialog(): argument 1 has unexpected type 'bool'

Hint: You probably want to be using self.

--
Robin

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: OpenFileDialog Doesn't appear

Vlastimil Brom
In reply to this post by srfpala
2018-10-02 23:43 GMT-22:00, srfpala <[hidden email]>:
> The attachment contains two programs written using PyScripter.
> The Open File Dialog (OFD)  works well in Program 1 but never appears
> in Program 2.  I believe the OFD code is the same in both programs.
> Resulting errors are shown after Program 2.
> Any ideas ?
> TIA
>   Bob
>
> --
Hi,
I believe, the difference might be the scoping regarding "frame"
in the first example, frame remains within the same class (with now
further structuring via functinos etc.) and is accessible for the the
call "wx.FileDialog(frame, ...)"

in the second example, these parts of code belong to separate
functions/method definitions (__init__ and onOpenFile respectively); i
believe making "frame" available within the class like self.frame =
... might solve the immediate problem with displaying a dialog, but
there seem to be other differences as well (it's not clear, whether it
is intended or not).

hth,
  vbr

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.