How to set the scaling factors of using wxDC:DrawText?

Hi,
   I found some example in demo but still no idea, If I want to print a text string using wxDC:DrawText with a fixed pitch font to different windows's printer(HP,Epson...etc), anyone can give me a complete example of calculate scaling factor?? eg. I want to print the text using Courier New - size 12 (size want to be as same as MS Word/Excel), I found the following example for printing canvas, but how can i get the value of maxX & maxY of using wxDC:DrawText to print??

        maxX = self.canvas.getWidth()
        maxY = self.canvas.getHeight()

        # Get the size of the DC in pixels
        (w, h) = dc.GetSizeTuple()

        # Calculate a suitable scaling factor
        scaleX = float(w) / maxX
        scaleY = float(h) / maxY

        # Use x or y scaling factor, whichever fits on the DC
        actualScale = min(scaleX, scaleY)

Viking wrote:

Hi, I found some example in demo but still no idea, If I want to
print a text string using wxDC:DrawText with a fixed pitch font to
different windows's printer(HP,Epson...etc), anyone can give me a
complete example of calculate scaling factor?? eg. I want to print
the text using Courier New - size 12 (size want to be as same as MS
Word/Excel),

I'm confused as to what you're trying to do. If you want to print with a
12 point font, you should be able to just use the PrinterDC.DrawText()
with a 12 point font.

I found the following example for printing canvas, but
how can i get the value of maxX & maxY of using wxDC:DrawText to
print??

Are you looking for DC.GetTextExtent() ?

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Hey guys,

does anybody have an idea on how to "lock" wxStyledTextCtrl on wxGTK so it will not flicker if you do a few things at once, like deleting and adding markers, going to a line and changing caret background?

Right now, it does flicker about twice when I perform these operations... is there anything like BeginUpdate() and EndUpdate() type functions?

- Lorant

Lorant Toth wrote:

Hey guys,

does anybody have an idea on how to "lock" wxStyledTextCtrl on wxGTK so it will not flicker if you do a few things at once, like deleting and adding markers, going to a line and changing caret background?

Right now, it does flicker about twice when I perform these operations... is there anything like BeginUpdate() and EndUpdate() type functions?

Not currently. If wxGTK gets an implementation for wxWindow::Freeze and wxWindow::Thaw then that will probably do it correctly, but so far they are only supported on wxMSW I think.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!