473,749 Members | 2,486 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

wxPython: Terminal Output -> Scrollable Panel?

First, I'm very new to gui programming, so please go lightly on me :)

Ok, so far I've settled on wxPython, and what I'd like to do as a first
leap is *convert* a text program into a gui program. It would have a
few buttons as function controls and one main scrollable panel that
acts like a terminal window.

I want to make it so that clicking on a button that performs an
operation will output it to the scrollable wxpython terminal panel, and
(if possible) save that output as text (or maybe into a logfile).

Anyone know how to do this? Like a log window? I've seen something like
this in a program called 'nicotine' but have no idea how to implement
it myself.

-thanks

Jul 19 '05 #1
4 4067
flamesrock wrote:
I want to make it so that clicking on a button that performs an
operation will output it to the scrollable wxpython terminal panel, and
(if possible) save that output as text (or maybe into a logfile).


The example code includes something called "PyCrust" which does pretty
much this. (The logging part is fairly trivial, so I won't mention it.)
I'm sure you could look in the source to learn more. You can start by
running the demo, and finding that particular one, playing with it a
bit, and then seeing how the demo code invokes PyCrust. Then find the
source for PyCrust in the wxPython folder (under your lib/site-packages
folder in c:\python24) and start reading.

-Peter
Jul 19 '05 #2
Thanks much for your response.

I looked at PyCrust, and while its given me a few cool ideas, I may
have described the problem incorrectly. What I really need is not
something that takes input, but merely redirects the 'print' statements
to something like a terminal window.

Is this even possible without entering the function calls directly into
a pycrust like terminal? Maybe I'm trying to do the wrong thing.

Thanks

Peter Hansen wrote:
flamesrock wrote:
I want to make it so that clicking on a button that performs an
operation will output it to the scrollable wxpython terminal panel, and
(if possible) save that output as text (or maybe into a logfile).


The example code includes something called "PyCrust" which does pretty
much this. (The logging part is fairly trivial, so I won't mention it.)
I'm sure you could look in the source to learn more. You can start by
running the demo, and finding that particular one, playing with it a
bit, and then seeing how the demo code invokes PyCrust. Then find the
source for PyCrust in the wxPython folder (under your lib/site-packages
folder in c:\python24) and start reading.

-Peter


Jul 19 '05 #3
flamesrock wrote:
I looked at PyCrust, and while its given me a few cool ideas, I may
have described the problem incorrectly. What I really need is not
something that takes input, but merely redirects the 'print' statements
to something like a terminal window.

Is this even possible without entering the function calls directly into
a pycrust like terminal? Maybe I'm trying to do the wrong thing.


PyCrust would show you a mechanism to get lines of text into a "terminal
window". Actually capturing those lines of output is a different story.
Here's one approach, if you have control over the print statements:

class Redirector:
def __init__(self, infoAboutTermin al):
# store "infoAboutTermi nal" in local attributes

def write(self, text):
'''output lines of text to terminal window'''
# here you do whatever PyCrust does to get output to its window
# using the info stored in the constructor

Assuming you have a PyCrust-like terminal window open somewhere,
you would create a Redirector and pass it whatever info about the
terminal window that it might need.

terminal = Redirector(info AboutPyCrustLik eWindow)

Then just send your prints to this location using the >> syntax sugar:

print >>terminal, 'This line of text goes to the GUI window.'
print >>terminal, 'So does all this\neven multiple lines...'

If you *don't* have the ability to change the print statements like
this, then you can install a Redirector in place of sys.stdout, but that
will affect all prints, including those in standard library modules and
elsewhere.

HTH
-Peter
Jul 19 '05 #4
Exactly what I'm looking for! Thanks

Jul 19 '05 #5

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

Similar topics

0
1311
by: Russell Reagan | last post by:
I installed wxPython 2.4.2.4 from the prebuilt binary for Windows. I am using the Cygwin version of Python 2.3.2. After installing wxPython, I ran the minimal window script: http://www.wxpython.org/test1.py.html That script gave this output: $ ./wxtest.py Traceback (most recent call last): File "./wxtest.py", line 20, in ? from wxPython.wx import *
15
3114
by: Polerio Babao Jr.II | last post by:
Please correct me if im wrong. I have depended much on python and wxpython gui apps. After a year of using python apps I was able to do good application written entirely in python. One big problem came into my attention. The printing support. Yes, there was reportlab. But what if your client wanted to simulate the customized excel output and have it converted to reportlab. you cannot do it 100%. There are so many drawbacks which I do not...
13
4588
by: Peter Maas | last post by:
Recently I replaced Win2k with Linux on my desktop computer. Using mostly multi-platform software I thought this would be easy. It was not as easy as expected getting wxPython to work. There seemed to be no SuSE RPM so I installed from source. Here are my steps (gtk 2.4 was already installed): - Built wxWidgets (.configure --enable-unicode) - Built wxPython (python setup.py install) error: "you should use wx-config program for...
2
4041
by: Grzegorz | last post by:
Hello, I'm using eclipse with pydev plugin, I'm working on a program using wxpython . When I'm executing that application standard error output does not show in eclipse console window - wxpython seems to redirect standard output to some another window , and closes that window immediately, so I can't see any error messagess. Is there a way to redirect standard output to eclipse console ?
16
2717
by: John Salerno | last post by:
Here's my new project: I want to write a little script that I can type at the terminal like this: $ scriptname package1 where scriptname is my module name and any subsequent arguments are the names of Linux packages to install. Running the script as above will create this line: sudo aptitude install package1 package2 ...
4
5137
by: 7stud | last post by:
Hi, I'm using an intel imac which came with python 2.3.5 pre-intstalled on OS 10.4.7. I was able run a hello world wxPython script in Terminal by typing: $pythonw wxPythonTest.py Yesterday, I installed python 2.4.4 which I downloaded from the MacPython website, and it seems to have installed correctly:
13
4607
by: sayansayan | last post by:
two threads are running in a prog i need the output of one thread in a new terminal which the prog will create and the output of other thread in the old terminal
44
4996
by: bg_ie | last post by:
Hi, I'm in the process of writing some code and noticed a strange problem while doing so. I'm working with PythonWin 210 built for Python 2.5. I noticed the problem for the last py file processed by this script, where the concerned tmp file is only actually written to when PythonWin is closed. In other words, after I run this script, one of the generated tmp files has a size of 0kB. I then close PythonWin and it is then written to.
4
2193
by: Timothy Smith | last post by:
Not sure exactly what I need to do to get wxPython to work on either of my Macs. (One's a notebook running Tiger (OS X 10.4.11), the other a Mac Pro running Leopard (10.5.1.)) I downloaded what should be the latest binary, and it installed without error. So Python comes up as $ python -V Python 2.5.1 $ ls -l /usr/bin/python
2
1604
by: David | last post by:
Hi list. I've never used unicode in a Python script before, but I need to now. I'm not sure where to start. I'm hoping that a kind soul can help me out here. My current (almost non-existant) knowledge of unicode: string types. What I don't understand yet is what encodings are and when you'd want/need to use them. What I'd like is to just be able to
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6800
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.