473,382 Members | 1,615 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

boa constructor - run script/output

Tom
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

Jul 18 '05 #1
1 4484
Tom
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


Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Christian Brechbühler | last post by:
I get a compile time error that I don't understand. ======================================= begin constructor.cc ====== struct Negate {}; class A { int i; public: A(double x ):...
3
by: Jun | last post by:
I have following script <script> var Animal = function(name){ this.name = name; } Animal.prototype.eat = function (food) {
6
by: cppaddict | last post by:
Hi, I know that C++ does not have an explicit super() constructor for calling a Base class constructor from a Derived class's constructor, but my understanding is that C++ implements this...
4
by: Jerry Krinock | last post by:
I've written the following demo to help me understand a problem I'm having in a larger program. The "main" function constructs a Foo object, and then later "reconstructs" it by calling the...
9
by: Player | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello all. I am in the process of teaching myself C# and I think I am doing OK. I have learnt how to how to call the right constructor of a...
5
by: sarathy | last post by:
Hi, I need to see the output of the program when no copy constructor is used. Since by default, there is an implicit one, how should i perform the override, so as to totally remove the copy...
26
by: Patient Guy | last post by:
The code below shows the familiar way of restricting a function to be a method of a constructed object: function aConstructor(arg) { if (typeof(arg) == "undefined") return (null);...
3
by: Wilson | last post by:
i am very new to c++ and am creating a new program, below are two seperate parts of the program, made to run seperately, however the constructor in one works (prints "constructing" on the screen),...
4
by: George2 | last post by:
Hello everyone, Why visual studio does not optimize constructor in this case? I do not understand what the MSDN mentioned, if use different named object, compiler can not optimize. Why? ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.