471,348 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

A couple of questions on OGL

Hi everybody,

I am developing a little graph editor using python 2.5 and wx 2.8. Whenever I try to add text to a line shape I get a big rectangle on the background which covers the shapes. Is there a way to render the text on a transparent background? I googled and found the same question in several places, but no answers :)

The second thing is: If I am drawing a lineshape as an spline, control points are fixed. Is there a way to update the position of this control points when I move the shapes which are connected to the line?

Thanks!
Jul 10 '07 #1
5 1091
bartonc
6,596 Expert 4TB
Sorry, wildjack. I'm not much of a graphics guy.


I am very interested in feedback on Boa 0.6. I've yet to try switching for 0.5.2 (right in the middle of a big project), but would do it if I heard a few more positive experiences getting the installation to work.

Keep in touch.
Jul 11 '07 #2
Hi Barton,

Although I have previous experience with other languages, I'm new to Python (only a few weeks developing things). I began by installing 0.4.4 to give it a try and started developing this graph editor I commented before. I really liked the IDE, so I checked out 0.6.0 from sourceforge CVS and kept on developing with it. The switch was almost seamless. There was some deprecated stuff in the generated code which wouldn't work with the designer, but substituted the code which wasn't working in a few minutes and everything started running again. As for the rest, 0.6.0 runs smoothly. So far, I haven't experienced any problems with it ( Anyway, take into account that I'm working on a small thing, ~3500 lines). If you have further questions, I'll be glad to help :)

Best regards,
Wildjack
Jul 11 '07 #3
bartonc
6,596 Expert 4TB
Hi Barton,

Although I have previous experience with other languages, I'm new to Python (only a few weeks developing things). I began by installing 0.4.4 to give it a try and started developing this graph editor I commented before. I really liked the IDE, so I checked out 0.6.0 from sourceforge CVS and kept on developing with it. The switch was almost seamless. There was some deprecated stuff in the generated code which wouldn't work with the designer, but substituted the code which wasn't working in a few minutes and everything started running again. As for the rest, 0.6.0 runs smoothly. So far, I haven't experienced any problems with it ( Anyway, take into account that I'm working on a small thing, ~3500 lines). If you have further questions, I'll be glad to help :)

Best regards,
Wildjack
Thanks Wildjack. I'd definitely appreciate you hanging around the forum a bit. I've been use Boa 0.5.2 for about 9 months and contribute to its development in some small ways (tiny code updates when I find them) so you are actually running a bit of my work. I just get nervous, changing tools in the middle of a project. It truly is a great piece of software. Saves me hours of layout and I've gotten good at adding to & reusing the generated code without upsetting the designer. Tons o' fun!

Keep in touch.
Jul 11 '07 #4
Ok, finally I figured out a way to solve the transparent bg problem for text in lineshapes:

* First we create our own line class inheriting from LineShape.


* Then we override the DrawRegion method, and we comment out the line marked with *** like this:
Expand|Select|Wrap|Line Numbers
  1. def DrawRegion(self, dc, region, x, y):
  2.         """Format one region at this position."""
  3.         if self.GetDisableLabel():
  4.             return
  5.  
  6.         w, h = region.GetSize()
  7.  
  8.         # Get offset from x, y
  9.         xx, yy = region.GetPosition()
  10.  
  11.         xp = xx + x
  12.         yp = yy + y
  13.  
  14.         # First, clear a rectangle for the text IF there is any
  15.         if len(region.GetFormattedText()):
  16.             dc.SetPen(self.GetBackgroundPen())
  17.             dc.SetBrush(self.GetBackgroundBrush())
  18.  
  19.             # Now draw the text
  20.             if region.GetFont():
  21.                 dc.SetFont(region.GetFont())
  22.   ****         #dc.DrawRectangle(xp - w / 2.0, yp - h / 2.0, w, h)
  23.  
  24.                 if self._pen:
  25.                     dc.SetPen(self._pen)
  26.                 dc.SetTextForeground(region.GetActualColourObject())
  27.  
  28.                 DrawFormattedText(dc, region.GetFormattedText(), xp, yp, w, h, region.GetFormatMode())

This quick fix worked for me. So far everything seems to work fine. As for the line control points problem, I have managed to create control points with handles to move them manually (it's not what I intended to do but it is ok for the moment).
Jul 15 '07 #5
bartonc
6,596 Expert 4TB
Thanks for the OGL update, Wildjack.

Also, I made the upgrade to Boa Constructio 0.6.1. Works great (after I rebooted my machine). Thanks again.
Jul 20 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by bjs | last post: by
1 post views Thread by hoochiegooch | last post: by
21 posts views Thread by Rob Somers | last post: by
4 posts views Thread by Sccr18 | last post: by
3 posts views Thread by punt | last post: by
reply views Thread by Marc | last post: by
3 posts views Thread by Ron | last post: by
3 posts views Thread by melton9 | last post: by
reply views Thread by Newish | last post: by

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.