1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.platebtn
.. highlight:: python
.. _wx.lib.platebtn.PlateButton:
==========================================================================================================================================
|phoenix_title| **wx.lib.platebtn.PlateButton**
==========================================================================================================================================
PlateButton is a custom type of flat button with support for
displaying bitmaps and having an attached dropdown menu.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>PlateButton</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.lib.platebtn.PlateButton_inheritance.png" alt="Inheritance diagram of PlateButton" usemap="#dummy" class="inheritance"/></center>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.platebtn.PlateButton.html" title="wx.lib.platebtn.PlateButton" alt="" coords="9,392,208,421"/> <area shape="rect" id="node2" href="wx.Control.html" title="wx.Control" alt="" coords="63,315,155,344"/> <area shape="rect" id="node3" href="wx.Window.html" title="wx.Window" alt="" coords="60,237,157,267"/> <area shape="rect" id="node4" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="44,160,173,189"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="50,83,167,112"/> <area shape="rect" id="node6" href="wx.Object.html" title="wx.Object" alt="" coords="5,5,92,35"/> <area shape="rect" id="node7" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="117,5,223,35"/> </map>
</p>
</div>
|
|super_classes| Known Superclasses
==================================
:class:`wx.Control`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.platebtn.PlateButton.__init__` Create a PlateButton
:meth:`~wx.lib.platebtn.PlateButton.AcceptsFocus` Can this window have the focus?
:meth:`~wx.lib.platebtn.PlateButton.Disable` Disable the control
:meth:`~wx.lib.platebtn.PlateButton.DoGetBestSize` Calculate the best size of the button
:meth:`~wx.lib.platebtn.PlateButton.Enable` Enable/Disable the control
:meth:`~wx.lib.platebtn.PlateButton.GetBackgroundBrush` Get the brush for drawing the background of the button
:meth:`~wx.lib.platebtn.PlateButton.GetBitmapDisabled` Get the bitmap of the disable state
:meth:`~wx.lib.platebtn.PlateButton.GetBitmapLabel` Get the label bitmap
:meth:`~wx.lib.platebtn.PlateButton.GetMenu` Return the menu associated with this button or None if no
:meth:`~wx.lib.platebtn.PlateButton.GetState` Get the current state of the button
:meth:`~wx.lib.platebtn.PlateButton.HasTransparentBackground` Override setting of background fill
:meth:`~wx.lib.platebtn.PlateButton.IsPressed` Return if button is pressed (PB_STYLE_TOGGLE)
:meth:`~wx.lib.platebtn.PlateButton.OnErase` Trap the erase event to keep the background transparent
:meth:`~wx.lib.platebtn.PlateButton.OnFocus` Set the visual focus state if need be
:meth:`~wx.lib.platebtn.PlateButton.OnKeyUp` Execute a single button press action when the Return key is pressed
:meth:`~wx.lib.platebtn.PlateButton.OnKillFocus` Set the visual state back to normal when focus is lost
:meth:`~wx.lib.platebtn.PlateButton.OnLeftDown` Sets the pressed state and depending on the click position will
:meth:`~wx.lib.platebtn.PlateButton.OnLeftUp` Post a button event if the control was previously in a
:meth:`~wx.lib.platebtn.PlateButton.OnMenuClose` Refresh the control to a proper state after the menu has been
:meth:`~wx.lib.platebtn.PlateButton.SetBitmap` Set the bitmap displayed in the button
:meth:`~wx.lib.platebtn.PlateButton.SetBitmapDisabled` Set the bitmap for the disabled state
:meth:`~wx.lib.platebtn.PlateButton.SetFocus` Set this control to have the focus
:meth:`~wx.lib.platebtn.PlateButton.SetFont` Adjust size of control when font changes
:meth:`~wx.lib.platebtn.PlateButton.SetLabel` Set the label of the button
:meth:`~wx.lib.platebtn.PlateButton.SetLabelColor` Set the color of the label. The optimal label color is usually
:meth:`~wx.lib.platebtn.PlateButton.SetMenu` Set the menu that can be shown when clicking on the
:meth:`~wx.lib.platebtn.PlateButton.SetPressColor` Set the color used for highlighting the pressed state
:meth:`~wx.lib.platebtn.PlateButton.SetWindowStyle` Sets the window style bytes, the updates take place
:meth:`~wx.lib.platebtn.PlateButton.SetWindowVariant` Set the variant/font size of this control
:meth:`~wx.lib.platebtn.PlateButton.ShouldInheritColours` Overridden base class virtual. If the parent has non-default
:meth:`~wx.lib.platebtn.PlateButton.ShowMenu` Show the dropdown menu if one is associated with this control
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.lib.platebtn.PlateButton.BitmapDisabled`
:attr:`~wx.lib.platebtn.PlateButton.BitmapFocus`
:attr:`~wx.lib.platebtn.PlateButton.BitmapHover`
:attr:`~wx.lib.platebtn.PlateButton.BitmapLabel`
:attr:`~wx.lib.platebtn.PlateButton.BitmapSelected`
:attr:`~wx.lib.platebtn.PlateButton.LabelText`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: PlateButton(wx.Control)
PlateButton is a custom type of flat button with support for
displaying bitmaps and having an attached dropdown menu.
.. method:: __init__(self, parent, id=wx.ID_ANY, label='', bmp=None, pos=wx.DefaultPosition, size=wx.DefaultSize, style=PB_STYLE_DEFAULT, name=wx.ButtonNameStr)
Create a PlateButton
:keyword string `label`: Buttons label text
:keyword wx.Bitmap `bmp`: Buttons bitmap
:keyword `style`: Button style
.. method:: AcceptsFocus(self)
Can this window have the focus?
.. method:: Disable(self)
Disable the control
.. method:: DoGetBestSize(self)
Calculate the best size of the button
:return: :class:`wx.Size`
.. method:: Enable(self, enable=True)
Enable/Disable the control
.. method:: GetBackgroundBrush(self, dc)
Get the brush for drawing the background of the button
:return: :class:`wx.Brush`
..note::
used internally when on gtk
.. method:: GetBitmapDisabled(self)
Get the bitmap of the disable state
:return: :class:`wx.Bitmap` or None
.. method:: GetBitmapLabel(self)
Get the label bitmap
:return: :class:`wx.Bitmap` or None
.. method:: GetMenu(self)
Return the menu associated with this button or None if no
menu is associated with it.
.. method:: GetState(self)
Get the current state of the button
:return: int
.. seeAlso::
PLATE_NORMAL, PLATE_HIGHLIGHT, PLATE_PRESSED
.. method:: HasTransparentBackground(self)
Override setting of background fill
.. method:: IsPressed(self)
Return if button is pressed (PB_STYLE_TOGGLE)
:return: bool
.. method:: OnErase(self, evt)
Trap the erase event to keep the background transparent
on windows.
:param `evt`: wx.EVT_ERASE_BACKGROUND
.. method:: OnFocus(self, evt)
Set the visual focus state if need be
.. method:: OnKeyUp(self, evt)
Execute a single button press action when the Return key is pressed
and this control has the focus.
:param `evt`: wx.EVT_KEY_UP
.. method:: OnKillFocus(self, evt)
Set the visual state back to normal when focus is lost
unless the control is currently in a pressed state.
.. method:: OnLeftDown(self, evt)
Sets the pressed state and depending on the click position will
show the popup menu if one has been set.
.. method:: OnLeftUp(self, evt)
Post a button event if the control was previously in a
pressed state.
:param `evt`: :class:`wx.MouseEvent`
.. method:: OnMenuClose(self, evt)
Refresh the control to a proper state after the menu has been
dismissed.
:param `evt`: wx.EVT_MENU_CLOSE
.. method:: SetBitmap(self, bmp)
Set the bitmap displayed in the button
:param `bmp`: :class:`wx.Bitmap`
.. method:: SetBitmapDisabled(self, bmp)
Set the bitmap for the disabled state
:param `bmp`: :class:`wx.Bitmap`
.. method:: SetFocus(self)
Set this control to have the focus
.. method:: SetFont(self, font)
Adjust size of control when font changes
.. method:: SetLabel(self, label)
Set the label of the button
:param string `label`: label string
.. method:: SetLabelColor(self, normal, hlight=wx.NullColour)
Set the color of the label. The optimal label color is usually
automatically selected depending on the button color. In some
cases the colors that are chosen may not be optimal.
The normal state must be specified, if the other two params are left
Null they will be automatically guessed based on the normal color. To
prevent this automatic color choices from happening either specify
a color or None for the other params.
:param wx.Colour `normal`: Label color for normal state (:class:`wx.Colour`)
:keyword wx.Colour `hlight`: Color for when mouse is hovering over
.. method:: SetMenu(self, menu)
Set the menu that can be shown when clicking on the
drop arrow of the button.
:param wx.Menu `menu`: :class:`wx.Menu` to use as a PopupMenu
.. note::
Arrow is not drawn unless a menu is set
.. method:: SetPressColor(self, color)
Set the color used for highlighting the pressed state
:param wx.Colour `color`: :class:`wx.Colour`
.. note::
also resets all text colours as necessary
.. method:: SetWindowStyle(self, style)
Sets the window style bytes, the updates take place
immediately no need to call refresh afterwards.
:param `style`: bitmask of PB_STYLE_* values
.. method:: SetWindowVariant(self, variant)
Set the variant/font size of this control
.. method:: ShouldInheritColours(self)
Overridden base class virtual. If the parent has non-default
colours then we want this control to inherit them.
.. method:: ShowMenu(self)
Show the dropdown menu if one is associated with this control
|