Package wx :: Class BitmapButton
[frames | no frames]

Type BitmapButton

object --+                    
         |                    
    Object --+                
             |                
    EvtHandler --+            
                 |            
            Window --+        
                     |        
               Control --+    
                         |    
                    Button --+
                             |
                            BitmapButton

Known Subclasses:
ColourSelect, ContextHelpButton, FoldOutMenu

A Button that contains a bitmap. A bitmap button can be supplied with a single bitmap, and wxWidgets will draw all button states using this bitmap. If the application needs more control, additional bitmaps for the selected state, unpressed focused state, and greyed-out state may be supplied.

Window Styles

wx.BU_AUTODRAW If this is specified, the button will be drawn automatically using the label bitmap only, providing a 3D-look border. If this style is not specified, the button will be drawn without borders and using all provided bitmaps. WIN32 only.
wx.BU_LEFT Left-justifies the label. WIN32 only.
wx.BU_TOP Aligns the label to the top of the button. WIN32 only.
wx.BU_RIGHT Right-justifies the bitmap label. WIN32 only.
wx.BU_BOTTOM Aligns the label to the bottom of the button. WIN32 only.
wx.BU_EXACTFIT Creates the button as small as possible instead of making it of the standard size (which is the default behaviour.)

Events

EVT_BUTTON Sent when the button is clicked.

See Also:

wx.Button, wx.Bitmap

Method Summary
BitmapButton __init__(self, parent, id, bitmap, pos, size, style, validator, name)
Create and show a button with a bitmap for the label.
  __repr__(self)
bool Create(self, parent, id, bitmap, pos, size, style, validator, name)
Acutally create the GUI BitmapButton for 2-phase creation.
Bitmap GetBitmapDisabled(self)
Returns the bitmap for the disabled state.
Bitmap GetBitmapFocus(self)
Returns the bitmap for the focused state.
Bitmap GetBitmapLabel(self)
Returns the label bitmap (the one passed to the constructor).
Bitmap GetBitmapSelected(self)
Returns the bitmap for the selected state.
int GetMarginX(self)
int GetMarginY(self)
  SetBitmapDisabled(self, bitmap)
Sets the bitmap for the disabled button appearance.
  SetBitmapFocus(self, bitmap)
Sets the bitmap for the button appearance when it has the keyboard focus.
  SetBitmapLabel(self, bitmap)
Sets the bitmap label for the button.
  SetBitmapSelected(self, bitmap)
Sets the bitmap for the selected (depressed) button appearance.
  SetMargins(self, x, y)
    Inherited from Button
VisualAttributes GetClassDefaultAttributes(variant)
Get the default attributes for this class. (Static method)
Size GetDefaultSize()
Returns the default button size for this platform. (Static method)
  SetDefault(self)
This sets the button to be the default item for the panel or dialog box.
    Inherited from Control
  Command(self, event)
Simulates the effect of the user issuing a command to the item.
String GetLabel(self)
Return a control's text.
  SetLabel(self, label)
Sets the item's text.
    Inherited from Window
bool AcceptsFocus(self)
Can this window have focus?
bool AcceptsFocusFromKeyboard(self)
Can this window be given focus by keyboard navigation? if not, the only way to give it focus (provided it accepts it at all) is to click it.
  AddChild(self, child)
Adds a child window.
  AssociateHandle(self, handle)
Associate the window with a new native handle
  CacheBestSize(self, size)
Cache the best size so it doesn't need to be calculated again, (at least until some properties of the window change.)
  CaptureMouse(self)
Directs all mouse input to this window.
  Center(self, direction)
Centers the window.
  CenterOnParent(self, dir)
Center with respect to the the parent window
  CenterOnScreen(*args, **kwargs)
<function CenterOnScreen at 0xb7bc94c4> is deprecated
  Centre(self, direction)
Centers the window.
  CentreOnParent(self, dir)
Center with respect to the the parent window
  CentreOnScreen(*args, **kwargs)
<function CenterOnScreen at 0xb7bc94c4> is deprecated
  ClearBackground(self)
Clears the window by filling it with the current background colour.
Point ClientToScreen(self, pt)
Converts to screen coordinates from coordinates relative to this window.
(x,y) ClientToScreenXY(x, y)
Converts to screen coordinates from coordinates relative to this window.
bool Close(self, force)
This function simply generates a EVT_CLOSE event whose handler usually tries to close the window.
Point ConvertDialogPointToPixels(self, pt)
Converts a point or size from dialog units to pixels.
Size ConvertDialogSizeToPixels(self, sz)
Converts a point or size from dialog units to pixels.
Point ConvertPixelPointToDialog(self, pt)
Size ConvertPixelSizeToDialog(self, sz)
bool Destroy(self)
Destroys the window safely.
bool DestroyChildren(self)
Destroys all children of a window.
bool Disable(self)
Disables the window, same as Enable(false).
  DissociateHandle(self)
Dissociate the current native handle from the window
Point DLG_PNT(self, pt)
Converts a point or size from dialog units to pixels.
Size DLG_SZE(self, sz)
Converts a point or size from dialog units to pixels.
  DragAcceptFiles(self, accept)
Enables or disables eligibility for drop file events, EVT_DROP_FILES.
bool Enable(self, enable)
Enable or disable the window for user input.
Window FindFocus()
Returns the window or control that currently has the keyboard focus, or None. (Static method)
Window FindWindowById(self, winid)
Find a chld of this window by window ID
Window FindWindowByName(self, name)
Find a child of this window by name
  Fit(self)
Sizes the window so that it fits around its subwindows.
  FitInside(self)
Similar to Fit, but sizes the interior (virtual) size of a window.
  Freeze(self)
Freezes the window or, in other words, prevents any updates from taking place on screen, the window is not redrawn at all.
AcceleratorTable GetAcceleratorTable(self)
Gets the accelerator table for this window.
Size GetAdjustedBestSize(self)
This method is similar to GetBestSize, except in one thing.
bool GetAutoLayout(self)
Returns the current autoLayout setting
Colour GetBackgroundColour(self)
Returns the background colour of the window.
int GetBackgroundStyle(self)
Returns the background style of the window.
Size GetBestFittingSize(self)
This function will merge the window's best size into the window's minimum size, giving priority to the min size components, and returns the results.
Size GetBestSize(self)
This function returns the best acceptable minimal size for the window, if applicable.
(width, height) GetBestSizeTuple()
This function returns the best acceptable minimal size for the window, if applicable.
Size GetBestVirtualSize(self)
Return the largest of ClientSize and BestSize (as determined by a sizer, interior children, or other means)
int GetBorder(self, flags)
GetBorder(self) -> int
Window GetCapture()
Returns the window which currently captures the mouse or None (Static method)
Caret GetCaret(self)
Returns the caret associated with the window.
int GetCharHeight(self)
Get the (average) character size for the current font.
int GetCharWidth(self)
Get the (average) character size for the current font.
PyObject GetChildren(self)
Returns a list of the window's children.
Point GetClientAreaOrigin(self)
Get the origin of the client area of the window relative to the window's top left corner (the client area may be shifted because of the borders, scrollbars, other decorations...)
Rect GetClientRect(self)
Get the client area position and size as a wx.Rect object.
Size GetClientSize(self)
This gets the size of the window's 'client area' in pixels.
(width, height) GetClientSizeTuple()
This gets the size of the window's 'client area' in pixels.
LayoutConstraints GetConstraints(self)
Returns a pointer to the window's layout constraints, or None if there are none.
Sizer GetContainingSizer(self)
Return the sizer that this window is a member of, if any, otherwise None.
Cursor GetCursor(self)
Return the cursor associated with this window.
VisualAttributes GetDefaultAttributes(self)
Get the default attributes for an instance of this class.
Window GetDefaultItem(self)
Get the default child of this parent, i.e.
DropTarget GetDropTarget(self)
Returns the associated drop target, which may be None.
EvtHandler GetEventHandler(self)
Returns the event handler for this window.
long GetExtraStyle(self)
Returns the extra style bits for the window.
Font GetFont(self)
Returns the default font used for this window.
Colour GetForegroundColour(self)
Returns the foreground colour of the window.
(width, height, descent, externalLeading) GetFullTextExtent(string, font)
Get the width, height, decent and leading of the text using the current or specified font.
Window GetGrandParent(self)
Returns the parent of the parent of this window, or None if there isn't one.
long GetHandle(self)
Returns the platform-specific handle (as a long integer) of the physical window.
String GetHelpText(self)
Gets the help text to be used as context-sensitive help for this window.
int GetId(self)
Returns the identifier of the window.
int GetMaxHeight(self)
Size GetMaxSize(self)
int GetMaxWidth(self)
int GetMinHeight(self)
Size GetMinSize(self)
int GetMinWidth(self)
String GetName(self)
Returns the windows name.
Window GetParent(self)
Returns the parent window of this window, or None if there isn't one.
Point GetPosition(self)
Get the window's position.
(x,y) GetPositionTuple()
Get the window's position.
Rect GetRect(self)
Returns the size and position of the window as a wx.Rect object.
int GetScrollPos(self, orientation)
Returns the built-in scrollbar position.
int GetScrollRange(self, orientation)
Returns the built-in scrollbar range.
int GetScrollThumb(self, orientation)
Returns the built-in scrollbar thumb size.
Size GetSize(self)
Get the window size.
Sizer GetSizer(self)
Return the sizer associated with the window by a previous call to SetSizer or None if there isn't one.
(width, height) GetSizeTuple()
Get the window size.
(width, height) GetTextExtent(string)
Get the width and height of the text using the current font.
bool GetThemeEnabled(self)
Return the themeEnabled flag.
String GetTitle(self)
Gets the window's title.
ToolTip GetToolTip(self)
get the associated tooltip or None if none
Rect GetUpdateClientRect(self)
Get the update rectangle region bounding box in client coords.
Region GetUpdateRegion(self)
Returns the region specifying which parts of the window have been damaged.
Validator GetValidator(self)
Returns a pointer to the current validator for the window, or None if there is none.
Size GetVirtualSize(self)
Get the the virtual size of the window in pixels.
(width, height) GetVirtualSizeTuple()
Get the the virtual size of the window in pixels.
long GetWindowStyle(self)
Gets the window style that was passed to the constructor or Create method.
long GetWindowStyleFlag(self)
Gets the window style that was passed to the constructor or Create method.
int GetWindowVariant(self)
bool HasCapture(self)
Returns true if this window has the current mouse capture.
bool HasFlag(self, flag)
Test if the given style is set for this window.
bool HasScrollbar(self, orient)
Does the window have the scrollbar for this orientation?
bool HasTransparentBackground(self)
Returns True if this window's background is transparent (as, for example, for wx.StaticText) and should show the parent window's background.
bool Hide(self)
Equivalent to calling Show(False).
int HitTest(self, pt)
Test where the given (in client coords) point lies
int HitTestXY(self, x, y)
Test where the given (in client coords) point lies
  InheritAttributes(self)
This function is (or should be, in case of custom controls) called during window creation to intelligently set up the window visual attributes, that is the font and the foreground and background colours.
bool InheritsBackgroundColour(self)
  InitDialog(self)
Sends an EVT_INIT_DIALOG event, whose handler usually transfers data to the dialog via validators.
  InvalidateBestSize(self)
Reset the cached best size value so it will be recalculated the next time it is needed.
bool IsBeingDeleted(self)
Is the window in the process of being deleted?
bool IsEnabled(self)
Returns true if the window is enabled for input, false otherwise.
bool IsExposed(self, x, y, w, h)
Returns true if the given point or rectangle area has been exposed since the last repaint.
bool IsExposedPoint(self, pt)
Returns true if the given point or rectangle area has been exposed since the last repaint.
bool IsExposedRect(self, rect)
Returns true if the given point or rectangle area has been exposed since the last repaint.
bool IsRetained(self)
Returns true if the window is retained, false otherwise.
bool IsShown(self)
Returns true if the window is shown, false if it has been hidden.
bool IsTopLevel(self)
Returns true if the given window is a top-level one.
bool Layout(self)
Invokes the constraint-based layout algorithm or the sizer-based algorithm for this window.
bool LineDown(self)
This is just a wrapper for ScrollLines(1).
bool LineUp(self)
This is just a wrapper for ScrollLines(-1).
  Lower(self)
Lowers the window to the bottom of the window hierarchy.
  MakeModal(self, modal)
Disables all other windows in the application so that the user can only interact with this window.
  Move(self, pt, flags)
Moves the window to the given position.
  MoveAfterInTabOrder(self, win)
Moves this window in the tab navigation order after the specified sibling window.
  MoveBeforeInTabOrder(self, win)
Same as MoveAfterInTabOrder except that it inserts this window just before win instead of putting it right after it.
  MoveXY(self, x, y, flags)
Moves the window to the given position.
bool Navigate(self, flags)
Does keyboard navigation from this window to another, by sending a wx.NavigationKeyEvent.
int NewControlId()
Generate a control id for the controls which were not given one. (Static method)
int NextControlId(winid)
Get the id of the control following the one with the given autogenerated) id (Static method)
bool PageDown(self)
This is just a wrapper for ScrollPages(1).
bool PageUp(self)
This is just a wrapper for ScrollPages(-1).
EvtHandler PopEventHandler(self, deleteHandler)
Removes and returns the top-most event handler on the event handler stack.
bool PopupMenu(self, menu, pos)
Pops up the given menu at the specified coordinates, relative to this window, and returns control when the user has dismissed the menu.
bool PopupMenuXY(self, menu, x, y)
Pops up the given menu at the specified coordinates, relative to this window, and returns control when the user has dismissed the menu.
  PostCreate(self, pre)
Phase 3 of the 2-phase create <wink!> Call this method after precreating the window with the 2-phase create method.
  PrepareDC(self, dc)
Call this function to prepare the device context for drawing a scrolled image.
int PrevControlId(winid)
Get the id of the control preceding the one with the given autogenerated) id (Static method)
  PushEventHandler(self, handler)
Pushes this event handler onto the event handler stack for the window.
  Raise(self)
Raises the window to the top of the window hierarchy.
  Refresh(self, eraseBackground, rect)
Mark the specified rectangle (or the whole window) as "dirty" so it will be repainted.
  RefreshRect(self, rect, eraseBackground)
Redraws the contents of the given rectangle: the area inside it will be repainted.
bool RegisterHotKey(self, hotkeyId, modifiers, keycode)
Registers a system wide hotkey.
  ReleaseMouse(self)
Releases mouse input captured with wx.Window.CaptureMouse.
  RemoveChild(self, child)
Removes a child window.
bool RemoveEventHandler(self, handler)
Find the given handler in the event handler chain and remove (but not delete) it from the event handler chain, return True if it was found and False otherwise (this also results in an assert failure so this function should only be called when the handler is supposed to be there.)
bool Reparent(self, newParent)
Reparents the window, i.e the window will be removed from its current parent window (e.g.
Point ScreenToClient(self, pt)
Converts from screen to client window coordinates.
(x,y) ScreenToClientXY(x, y)
Converts from screen to client window coordinates.
bool ScrollLines(self, lines)
If the platform and window class supports it, scrolls the window by the given number of lines down, if lines is positive, or up if lines is negative.
bool ScrollPages(self, pages)
If the platform and window class supports it, scrolls the window by the given number of pages down, if pages is positive, or up if pages is negative.
  ScrollWindow(self, dx, dy, rect)
Physically scrolls the pixels in the window and move child windows accordingly.
  SendSizeEvent(self)
  SetAcceleratorTable(self, accel)
Sets the accelerator table for this window.
  SetAutoLayout(self, autoLayout)
Determines whether the Layout function will be called automatically when the window is resized.
bool SetBackgroundColour(self, colour)
Sets the background colour of the window.
bool SetBackgroundStyle(self, style)
Returns the background style of the window.
  SetBestFittingSize(self, size)
A 'Smart' SetSize that will fill in default size components with the window's best size values.
  SetCaret(self, caret)
Sets the caret associated with the window.
  SetClientRect(self, rect)
This sets the size of the window client area in pixels.
  SetClientSize(self, size)
This sets the size of the window client area in pixels.
  SetClientSizeWH(self, width, height)
This sets the size of the window client area in pixels.
  SetConstraints(self, constraints)
Sets the window to have the given layout constraints.
  SetContainingSizer(self, sizer)
This normally does not need to be called by application code.
bool SetCursor(self, cursor)
Sets the window's cursor.
Window SetDefaultItem(self, child)
Set this child as default, return the old default.
  SetDimensions(self, x, y, width, height, sizeFlags)
Sets the position and size of the window in pixels.
  SetDropTarget(self, dropTarget)
Associates a drop target with this window.
  SetEventHandler(self, handler)
Sets the event handler for this window.
  SetExtraStyle(self, exStyle)
Sets the extra style bits for the window.
  SetFocus(self)
Set's the focus to this window, allowing it to receive keyboard input.
  SetFocusFromKbd(self)
Set focus to this window as the result of a keyboard action.
bool SetFont(self, font)
Sets the font for this window.
bool SetForegroundColour(self, colour)
Sets the foreground colour of the window.
  SetHelpText(self, text)
Sets the help text to be used as context-sensitive help for this window.
  SetHelpTextForId(self, text)
Associate this help text with all windows with the same id as this one.
  SetId(self, winid)
Sets the identifier of the window.
  SetMaxSize(self, maxSize)
A more convenient method than SetSizeHints for setting just the max size.
  SetMinSize(self, minSize)
A more convenient method than SetSizeHints for setting just the min size.
  SetName(self, name)
Sets the window's name.
  SetOwnBackgroundColour(self, colour)
  SetOwnFont(self, font)
  SetOwnForegroundColour(self, colour)
  SetPosition(self, pt, flags)
Moves the window to the given position.
  SetRect(self, rect, sizeFlags)
Sets the position and size of the window in pixels using a wx.Rect.
  SetScrollbar(self, orientation, position, thumbSize, range, refresh)
  SetScrollPos(self, orientation, pos, refresh)
Sets the position of one of the built-in scrollbars.
  SetSize(self, size)
Sets the size of the window in pixels.
  SetSizeHints(self, minW, minH, maxW, maxH, incW, incH)
Allows specification of minimum and maximum window sizes, and window size increments.
  SetSizeHintsSz(self, minSize, maxSize, incSize)
Allows specification of minimum and maximum window sizes, and window size increments.
  SetSizer(self, sizer, deleteOld)
Sets the window to have the given layout sizer.
  SetSizerAndFit(self, sizer, deleteOld)
The same as SetSizer, except it also sets the size hints for the window based on the sizer's minimum size.
  SetSizeWH(self, width, height)
Sets the size of the window in pixels.
  SetThemeEnabled(self, enableTheme)
code to draw the windows' background instead if its own background drawing code.
  SetTitle(self, title)
Sets the window's title.
  SetTmpDefaultItem(self, win)
Set this child as temporary default
  SetToolTip(self, tip)
Attach a tooltip to the window.
  SetToolTipString(self, tip)
Attach a tooltip to the window.
  SetValidator(self, validator)
Deletes the current validator (if any) and sets the window validator, having called wx.Validator.Clone to create a new validator of this type.
  SetVirtualSize(self, size)
Set the the virtual size of a window in pixels.
  SetVirtualSizeHints(self, minW, minH, maxW, maxH)
Allows specification of minimum and maximum virtual window sizes.
  SetVirtualSizeHintsSz(self, minSize, maxSize)
Allows specification of minimum and maximum virtual window sizes.
  SetVirtualSizeWH(self, w, h)
Set the the virtual size of a window in pixels.
  SetWindowStyle(self, style)
Sets the style of the window.
  SetWindowStyleFlag(self, style)
Sets the style of the window.
  SetWindowVariant(self, variant)
Sets the variant of the window/font size to use for this window, if the platform supports variants, for example, wxMac.
bool ShouldInheritColours(self)
Return true from here to allow the colours of this window to be changed by InheritAttributes, returning false forbids inheriting them from the parent window.
bool Show(self, show)
Shows or hides the window.
  Thaw(self)
Reenables window updating after a previous call to Freeze.
bool TransferDataFromWindow(self)
Transfers values from child controls to data areas specified by their validators.
bool TransferDataToWindow(self)
Transfers values to child controls from data areas specified by their validators.
bool UnregisterHotKey(self, hotkeyId)
Unregisters a system wide hotkey.
  Update(self)
Calling this method immediately repaints the invalidated area of the window instead of waiting for the EVT_PAINT event to happen, (normally this would usually only happen when the flow of control returns to the event loop.) Notice that this function doesn't refresh the window and does nothing if the window has been already repainted.
  UpdateWindowUI(self, flags)
This function sends EVT_UPDATE_UI events to the window.
bool UseBgCol(self)
bool Validate(self)
Validates the current values of the child controls using their validators.
  WarpPointer(self, x, y)
Moves the pointer to the given position on the window.
    Inherited from EvtHandler
  AddPendingEvent(self, event)
  Bind(self, event, handler, source, id, id2)
Bind an event to an event handler.
  Connect(self, id, lastId, eventType, func)
bool Disconnect(self, id, lastId, eventType)
bool GetEvtHandlerEnabled(self)
EvtHandler GetNextHandler(self)
EvtHandler GetPreviousHandler(self)
bool ProcessEvent(self, event)
  ProcessPendingEvents(self)
  SetEvtHandlerEnabled(self, enabled)
  SetNextHandler(self, handler)
  SetPreviousHandler(self, handler)
  Unbind(self, event, source, id, id2)
Disconencts the event handler binding for event from self.
    Inherited from Object
String GetClassName(self)
Returns the class name of the C++ class using wxRTTI.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
Return hash(x)...
  __new__(T, S, ...)
Return a new object with type S, a subtype of T...
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
Return str(x)...

Instance Method Details

__init__(self, parent, id=-1, bitmap=wxNullBitmap, pos=DefaultPosition, size=DefaultSize, style=BU_AUTODRAW, validator=DefaultValidator, name=ButtonNameStr)
(Constructor)

Create and show a button with a bitmap for the label.

Parameters:
parent
           (type=Window)

id
           (type=int)

bitmap
           (type=Bitmap)

pos
           (type=Point)

size
           (type=Size)

style
           (type=long)

validator
           (type=Validator)

name
           (type=String)

Returns:
BitmapButton
Overrides:
wx.Button.__init__

Create(self, parent, id=-1, bitmap=wxNullBitmap, pos=DefaultPosition, size=DefaultSize, style=BU_AUTODRAW, validator=DefaultValidator, name=ButtonNameStr)

Acutally create the GUI BitmapButton for 2-phase creation.

Parameters:
parent
           (type=Window)

id
           (type=int)

bitmap
           (type=Bitmap)

pos
           (type=Point)

size
           (type=Size)

style
           (type=long)

validator
           (type=Validator)

name
           (type=String)

Returns:
bool
Overrides:
wx.Button.Create

GetBitmapDisabled(self)

Returns the bitmap for the disabled state.

Returns:
Bitmap

GetBitmapFocus(self)

Returns the bitmap for the focused state.

Returns:
Bitmap

GetBitmapLabel(self)

Returns the label bitmap (the one passed to the constructor).

Returns:
Bitmap

GetBitmapSelected(self)

Returns the bitmap for the selected state.

Returns:
Bitmap

SetBitmapDisabled(self, bitmap)

Sets the bitmap for the disabled button appearance.

Parameters:
bitmap
           (type=Bitmap)

SetBitmapFocus(self, bitmap)

Sets the bitmap for the button appearance when it has the keyboard focus.

Parameters:
bitmap
           (type=Bitmap)

SetBitmapLabel(self, bitmap)

Sets the bitmap label for the button. This is the bitmap used for the unselected state, and for all other states if no other bitmaps are provided.

Parameters:
bitmap
           (type=Bitmap)

SetBitmapSelected(self, bitmap)

Sets the bitmap for the selected (depressed) button appearance.

Parameters:
bitmap
           (type=Bitmap)


Generated by Epydoc 2.1.20050511.rpd on Sat Jun 16 16:50:07 2007 http://epydoc.sf.net