How to open a pdf

I've used the previewPDF function from dabo with good success:
http://trac.dabodev.com/browser/trunk/dabo/lib/reportUtils.py
--Mark

···

On Tue, Dec 8, 2009 at 9:34 AM, Ignacio <ignacio.puyol@gmail.com> wrote:

Hi,

I'm making an application, and I would like to include a link or a button to
open a pdf that resides in the same folder as the .py archive, so I could
take both of them to another computer and run the program (and open the
pdf).

Do you know how I could do it?

Thanks,

Ignacio

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Ignacio wrote:

Thanks a lot for the help, I've checked it and it runs right, but now I have another problem.

I've inserted the function from dabo, and the program opens the file when I execute it, instead of when I click on a button. I attach the code here for if you have an idea of how to do it. (Some words are in Spanish because I'm making the project in Spanish, but they are not important, you can change them...)

2009/12/8 Mark Guagenti <mgenti@gentiweb.com <mailto:mgenti@gentiweb.com>>

    I've used the previewPDF function from dabo with good success:
    http://trac.dabodev.com/browser/trunk/dabo/lib/reportUtils.py
    --Mark

    > Hi,
    >
    > I'm making an application, and I would like to include a link or
    a button to
    > open a pdf that resides in the same folder as the .py archive,
    so I could
    > take both of them to another computer and run the program (and
    open the
    > pdf).
    >
    > Do you know how I could do it?
    >
    > Thanks,
    >
    > Ignacio
    >

Hi,

I think the problem lays here: self.Bind(wx.EVT_BUTTON, previewPDF('guia wxpython.pdf'), button1)

if you notice, you are *calling* previewPDF, and passing its return value; not *passing* the function as an argument

If you want to pass in extra arguments to a Bound method you'll have to use a lambda and execute your method inside the lambda:

func = lambda evt, y="guia wxpython.pdf": previewPDF(y)
self.Bind(wx.EVT_BUTTON, func, button1)

You need to send evt as the first parameter as wxpython sends its event object as the first argument to your callback methods

···

    On Tue, Dec 8, 2009 at 9:34 AM, Ignacio <ignacio.puyol@gmail.com > <mailto:ignacio.puyol@gmail.com>> wrote:

--
Steven Sproat, BSc
http://www.basicrpg.com/