473,405 Members | 2,210 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,405 software developers and data experts.

Insane crazy question - printing commands

Hi,
I'm doing something odd with pycairo and friends and I want to see what
commands are coming out of my objects.

Here's some code:

class Box:
def draw()
self.context.set_source_rgb(1, 0, 0)
self.context.rectangle(0, 00, 50, 50)
self.context.fill()

Box.draw() draws a red box, all fine. But, I *also* want it to output the
actual commands within the draw def to the console (or a file).

At the moment I am doing this:
class Box:
def draw()
self.context.set_source_rgb(1, 0, 0)
self.context.rectangle(0, 00, 50, 50)
self.context.fill()
print """
self.context.set_source_rgb(1, 0, 0)
self.context.rectangle(0, 00, 50, 50)
self.context.fill()
"""
Do you see the form? Is there some <voodoo magicpython introspection way I
can perform that automagically without having to use the print statement?

Something like:
class Box:
def draw()
self.context.set_source_rgb(1, 0, 0)
self.context.rectangle(0, 00, 50, 50)
self.context.fill()
def dump():
<mystical mindblowing stuff involving deep magic>

See, I told you it was insane :)

\d
Nov 6 '07 #1
0 910

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

Similar topics

6
by: Les Juby | last post by:
I'm trying to print a simple catalogue of products but where an image straddles a page break, the image either disappears completely or else the first half prints at the bottom of the page but the...
11
by: cybertof | last post by:
Hello, Is there a way to easily print a .pdf file to the printer ? (without an external component) Thanks.
0
by: Shapper | last post by:
Hello, I have this code in Global.asax: Sub Session_Start(Sender As Object, E As EventArgs) Dim cookie As HttpCookie = Request.Cookies("MyCookie") If Not cookie Is Nothing Then...
12
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but...
6
by: Siv | last post by:
Hi, I am getting into printing with VB.NET 2005 and want to implement the usual capability that a user can select a selection of pages. I have a report that is generated by my application that if...
6
by: thomas.luce | last post by:
Okay, I have been programming for a long time, and am getting back into C after about a 4 year break from it. Below is some code that won't compile for the life of me, and it is driving me crazy!...
6
by: Chris Dunaway | last post by:
The method for printing documents in .Net can be confusing, especially for newer users. I would like to create a way to simplify this process. My idea would be implemented using a PrintDocument...
3
by: Richard MSL | last post by:
I have an application that prints documents that it creates. It uses what I believe is a standard .NET way of doing so, like this: PrintDocument pd = new PrintDocument(); pd.PrintPage += new...
2
by: Brad Pears | last post by:
I have a vb.net 2005 application and am using the print preview screen. This screen has a printer icon on it that the user can use to print the document currently being viewed. It uses the default...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...

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.