Christopher Barker wrote: > Carl Karsten wrote: >> I am trying to make some translucent circles, and it isn't happening. The >> code >> below should have the red bleed through everything else, but everything else >> is >> opaque. > > FloatCanvas was written before wx had support for alpha channels. It > uses the older "DC" classes, that don't support transparency. You can > achieve what you want, but you'll need to create a new DrawObject that > uses a GraphicsContext to do the drawing. Here is an example that should > get you started: > > http://morticia.cs.dal.ca/FloatCanvas/wiki/SmoothLines
I took a stab at it, fumbled. may try again someday. for now I can live without. "I" don't even plan on using the app anytime soon, but some others asked me for it, and implementing FloatCanvas was on the todo list. When I used it I just had a really wide window I would drag around :) > > By the way, aside from time, I haven't converted all of FloatCanvas to > GraphicsContext, 'cause it can have substantially worse performance for > lots of complex objects. Would it make sense to be optional? > >> Also, why do I need .Canvas for .NavCanvas(self).Canvas when I don't for >> FloatCanvas(self)? > > Because NavCanvas is a wx.Panel that has a FloatCanvas on it, rather > than _being_ a FloatCanvas. I originally tried to delegate all the calls > made on NavCanvas to the underlying FloatCanvas, but things got confused > when there was a call that could apply to either the parent Panel or the > underlying FloatCanvas, so this seemed easier. > > NavCanvas is really just a convenience class that adds a toolbar for > you. For more complex applications, you'll probably want to just create > your own container class, perhaps using NavCanvas as a model. That makes sense. Is it too late to rename it? (NavFrame, NavPanel, NavThing...) > >> Also, the circle border does not scale. > > Correct -- I designed FloatCanvas with certain uses in mind -- usually > displaying data of some sort. In those use cases, you don't want the > line thicknesses and all scaling. > > In other uses, you certainly would want that (as you do!). It should be > pretty straightforward to make a new DrawObject class that scales the > line widths too. You might look at the ScaledText class to get an idea > how to do that -- it changes the font size with scale, which is similar > to changing the line width. > > Ideally this would be factored into all DrawObjects with a line width, > so that you could pass a flag in indicating whether you wanted line > widths scaled or not. Patches welcome! (I'd start by writing your own > circle class, to see how it's done, then figure out how it could be > better integrated with the existing classes) That sounds doable. Have a look at what I have done: http://lewifi.googlecode.com The first thing you will notice when you run it is: ZeroDivisionError: float division Which is what you get when there is no floorplan image. I am guessing it is raising an exception somewhere and getting lost. Know anything about it? If you don't have a floorplan, any old image will do. If you don't have wifi, that's a problem. The code is very "big ball of mud" that will only get worse as I add features. Any suggestions on how to organize it better? Carl K _______________________________________________ FloatCanvas mailing list [email protected] http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas
