If anyone has experience in with this, I'd love some input.
I'm wondering about the best way to get current window Sizes. Basically, I have this.. A wxFrame with a wxSplitterWindow in it. In the right side of the splitter, I have another splitter. In the top and bottom of that one, and in the left side of the first splitter, I have other controls. A panel, or a scrolled window or GenericDirList etc.
The left side of the first splitter takes up 80% or so of the frame. It's for viewing images which Im able to load and resize just great. I'd _like_ to resize the image based on the scrolled windows size. I am able to get the size of the wxFrame (because I set it.) I can even get a new size, when the wxFrame is stretched. What I can't get is the size of the scrolledwindow. I never set it explicitly...it just fills my left side of the splitter. I also tried to get it's position (thinking I could subtract from the size of the frame.) The position always return 0, 0 and the size always returns 20, 20. I'm mostly trying things like width, height = self.GetSizeTuple() or the GetSize that returns a wxPoint. Same results.
I'm guessing that my problem is in the setup of those window components. What's the best way to get those setup so that I can access it's actual current size. I also read about virtualSize, but I didn't quite understand what it was.
If anyone has experience in with this, I'd love some input.
I'm wondering about the best way to get current window Sizes.
theWindow.GetSize()
Basically, I have this.. A wxFrame with a wxSplitterWindow in it.
In the right side of the splitter, I have another splitter. In the
top and bottom of that one, and in the left side of the first
splitter, I have other controls. A panel, or a scrolled window or
GenericDirList etc.
The left side of the first splitter takes up 80% or so of the frame.
It's for viewing images which Im able to load and resize just great.
I'd _like_ to resize the image based on the scrolled windows size. I
am able to get the size of the wxFrame (because I set it.) I can
even get a new size, when the wxFrame is stretched. What I can't
get is the size of the scrolledwindow. I never set it
explicitly...it just fills my left side of the splitter. I also
tried to get it's position (thinking I could subtract from the size
of the frame.) The position always return 0, 0 and the size always
returns 20, 20. I'm mostly trying things like width, height =
self.GetSizeTuple() or the GetSize that returns a wxPoint. Same
results.
Are you sure the scrolled window is a chld of the splitter and that it was used in the call to the splitters Split* method? If it was then the splitter should be resizing and positioning the scrolled window to fill the space on it's side of the splitter, and scrolledWindow.GetSize() would return something other than 20,20. On the other hand, if the splitter window hasn't yet been resized itself yet then it won't have resized the scrolled window yet either. When are you trying to call GetSize()? If it's from some __init__ and the windows havn't been shown yet then what you describe above could happen. Try doing it later, like when the frame has been shown and you load a new image, or from a EVT_SIZE handler for the window...
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I am trying to place markers (white dots) on to a static bitmap image.
The image is already present.
Ive looked for proper drawing techniques but cannot find anything. My
problem is when I draw the markers to the wxMemoryDC, I cannot see them on
the static bitmap until I resize the frame or move the window on and off
the screen.
What is the proper way to draw data to a wxMemoryDC, wxPaintDC, etc?
What I am doing wrong?
Here is my code
···
========================================================================
########################################################## #on left down mouse click...
##########################################################
def mthdDaisyDuke(self, event):
x=int(self.gtrXCoord().GetValue())
y=int(self.gtrYCoord().GetValue())
rad=self.gtrSldRadius().GetValue()
color=self.gtrColor().GetStringSelection()
#write the marker to the bitmap
self.write(self.gtrBMPCrap().GetBitmap(), (x,y),color,rad)
############################################################ #place the marker on the bitmap
############################################################
def write(self,bitmap, pos, color,rad=1):
memory = wxMemoryDC( )
memory.SelectObject( bitmap )
#choose a color
if (color=="Red"):
brush=wxRED_BRUSH
elif (color=="Green"):
brush=wxGREEN_BRUSH
elif (color=="Blue"):
brush=wxBLUE_BRUSH
elif (color=="Black"):
brush=wxBLACK_BRUSH
else:
brush=wxWHITE_BRUSH
I appreciate any other comments on what I should be doing... Im relatively
new to this, and I dont feel I understand all concepts of drawing and
using wxMemoryDC, wxPaintDC, etc..
--
Regards,
Todd McCaskey
tmccaske@ecl.ufl.edu
Electronic Communication Laboratory
University of Florida
Gainesville, FL
-----------------------------------------
This email was sent using SquirrelMail.
"Webmail for nuts!" http://squirrelmail.org/
I am trying to place markers (white dots) on to a static bitmap image. The image is already present.
Ive looked for proper drawing techniques but cannot find anything. My
problem is when I draw the markers to the wxMemoryDC, I cannot see them on
the static bitmap until I resize the frame or move the window on and off
the screen.
You need to tell your wxStaticBitmap to Refresh() itself when you are done drawing to the bitmap.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
There is no need. The wrappers automatically convert to/from Python
string or unicode objects.
OK, how would I go about doing this? I want to make a RadioBox with a
default value in bold - like:
o Option A
o Option B (default) # This one in bold
o Option C
I wanted to do it like this:
default_selection = wxString("Option B (DEFAULT)")
default_selection.SetFont(wxFont(wxNORMAL_FONT.GetPointSize(), wxDEFAULT,
wxNORMAL, wxBOLD))
wxStrings are just data objects like a Python string. They don't have any GUI characteristics (like fonts) at all.
Is there a way to do what I am trying to achieve?
You'll have to do it without a wxRadioBox, but with a series of wxRadioButtons and a wxStatixBox instead. Each wxRadioButton is a separate widget that way and can have it's font set.
···
Robin Dunn <robin@alldunn.com> wrote on 28/02/2003 03:09:32 PM:
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Is that better (faster, less intensive) than using a wxClientDC and blit
approach?
···
Todd McCaskey wrote:
Hello all...
I am trying to place markers (white dots) on to a static bitmap image.
The image is already present.
Ive looked for proper drawing techniques but cannot find anything. My
problem is when I draw the markers to the wxMemoryDC, I cannot see
them on the static bitmap until I resize the frame or move the window
on and off the screen.
You need to tell your wxStaticBitmap to Refresh() itself when you are
done drawing to the bitmap.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
--------------------------------------------------------------------- To
unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org For
additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
--
Regards,
Todd McCaskey
tmccaske@ecl.ufl.edu
Electronic Communication Laboratory
University of Florida
Gainesville, FL
-----------------------------------------
This email was sent using SquirrelMail.
"Webmail for nuts!" http://squirrelmail.org/
This worked like a charm. I _was_ getting the size during the init
function.
One question (for anyone) on setting up windows with sizes. Is it best to
specify windows sizes when you initialize the window based on the parent
window? I don't specify a size in mine, or I do (-1. -1) and it fills the
parent. However, when I add an EVT_SIZE() callback, (so I can do some
things if the window is resized), it makes all my controls have no
size...just a little box in the parent window. I'm guessing that I'm
overriding the onsize stuff that happens by default. To fix it...I think I
sould specify size when I setup each window. Perhaps by getting
parent.GetSize or something, eh?
Not crutial...but any info would be appreciated.
Matt
···
----- Original Message -----
From: "Robin Dunn" <robin@alldunn.com>
To: <wxPython-users@lists.wxwindows.org>
Sent: Friday, February 28, 2003 12:16 PM
Subject: Re: [wxPython-users] Best way to find Window Sizes...
Matt Graham wrote:
> Hi there.
>
> If anyone has experience in with this, I'd love some input.
>
> I'm wondering about the best way to get current window Sizes.
theWindow.GetSize()
> Basically, I have this.. A wxFrame with a wxSplitterWindow in it.
> In the right side of the splitter, I have another splitter. In the
> top and bottom of that one, and in the left side of the first
> splitter, I have other controls. A panel, or a scrolled window or
> GenericDirList etc.
>
> The left side of the first splitter takes up 80% or so of the frame.
> It's for viewing images which Im able to load and resize just great.
> I'd _like_ to resize the image based on the scrolled windows size. I
> am able to get the size of the wxFrame (because I set it.) I can
> even get a new size, when the wxFrame is stretched. What I can't
> get is the size of the scrolledwindow. I never set it
> explicitly...it just fills my left side of the splitter. I also
> tried to get it's position (thinking I could subtract from the size
> of the frame.) The position always return 0, 0 and the size always
> returns 20, 20. I'm mostly trying things like width, height =
> self.GetSizeTuple() or the GetSize that returns a wxPoint. Same
> results.
Are you sure the scrolled window is a chld of the splitter and that it
was used in the call to the splitters Split* method? If it was then the
splitter should be resizing and positioning the scrolled window to fill
the space on it's side of the splitter, and scrolledWindow.GetSize()
would return something other than 20,20. On the other hand, if the
splitter window hasn't yet been resized itself yet then it won't have
resized the scrolled window yet either. When are you trying to call
GetSize()? If it's from some __init__ and the windows havn't been shown
yet then what you describe above could happen. Try doing it later, like
when the frame has been shown and you load a new image, or from a
EVT_SIZE handler for the window...
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
One question (for anyone) on setting up windows with sizes. Is it best to
specify windows sizes when you initialize the window based on the parent
window? I don't specify a size in mine, or I do (-1. -1) and it fills the
parent. However, when I add an EVT_SIZE() callback, (so I can do some
things if the window is resized), it makes all my controls have no
size...just a little box in the parent window. I'm guessing that I'm
overriding the onsize stuff that happens by default.
Correct.
To fix it...I think I
sould specify size when I setup each window. Perhaps by getting
parent.GetSize or something, eh?
No, because when the window resizes again the default handler still won't happen. The best way to ensure that a default handler is still called when you are handling the event yourself is to call event.Skip() in your handler. Then when yours returns the search for an event handler will continue and the default one will still be found.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!