boa constructor - run script/output

Discussion in 'Python' started by Tom, Jun 26, 2003.

  1. Tom

    Tom Guest

    Hi,

    I am pretty new to BC and python. I just designed a GUI with Boa
    Constructor. It looks good, but now I have two problems:

    1.) I already wrote a script in Python and want to run it in my GUI now.
    My script is not a class or anything like that. I usually just run it
    with Ctrl+F5 and it works perfectly. What do I have to tell my event
    handler in BC to run the script? I don't want to add the whole code (it
    is pretty long) directly to the code of my wxFrame1.py code.

    2.) My second problem is that I don't know how the script returns the
    output data (I used several print commands). I want to display my
    messages in another part of my window of my GUI. Right now I see all my
    messages in the little output Window in BC.

    Every help would be very much appreciated. I found the Boa Constructor
    tutorial very helpful, but not very extensive. I also couldn't find
    anymore help tutorials online.

    Thank you very much in advance.
    Tom
     
    Tom, Jun 26, 2003
    #1
    1. Advertising

  2. Tom

    Tom Guest

    Thanks for your answer.
    1.) yes, I had to put my whole script into a function. Didn't know that
    first. I wanted to run the whole script, but I think it works now.
    2.) I also think that the examples of wxPython are really great.
    Sometimes it is just hard to understand the code if you are a newbie.
    :) I worked on this all day and think that I did it now!:)

    Thanks for your help.
    Tom

    delphiro wrote:

    >problem 1)
    >
    >It sounds like you need to import your script
    >
    >import your_script_name
    >
    >and attach an event to the function that you want to call
    >from within your script
    >
    >for example;
    >
    >yourscript.py contains function 'DoThis()'
    >
    >in gui class:
    >
    >import yourscript.py
    >
    >some event
    >
    >def OnButtonMyButtonDown(self,event):
    > yourscript.DoThis()
    >
    >2)
    >
    >You will have to edit your script in a way that it
    >knows where to send it's output. This means you will
    >have to pass a widget (like wxTextCtrl) to your script
    >and output the messages to that widget.
    >
    >The best way to actualy learn wxPython for me was to study the
    >examples. They realy make things clear for almost any widget!
    >
    >Hope this helps,
    >Rob
    >
    >
    >
     
    Tom, Jun 26, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. klappnase

    Boa-Constructor and linux-mouse

    klappnase, Jul 30, 2003, in forum: Python
    Replies:
    0
    Views:
    327
    klappnase
    Jul 30, 2003
  2. Mark Carter

    boa-constructor bug: import string

    Mark Carter, Aug 5, 2003, in forum: Python
    Replies:
    1
    Views:
    460
    Javier Ruere
    Aug 5, 2003
  3. Stefan Behrens
    Replies:
    0
    Views:
    377
    Stefan Behrens
    Aug 12, 2003
  4. Turhan Ozen

    chaco & boa constructor

    Turhan Ozen, Sep 30, 2003, in forum: Python
    Replies:
    0
    Views:
    340
    Turhan Ozen
    Sep 30, 2003
  5. Anbeyon
    Replies:
    1
    Views:
    505
Loading...

Share This Page