Python/wxPython/wx.StaticBitmap: Difference between revisions

From Fundamental Ramen
Jump to navigation Jump to search
(Created page with "'''Documents''' * [https://docs.wxpython.org/wx.CheckBox.html#wx.CheckBox wxPython] * [https://wiki.wxwidgets.org/Using_XML_Resources_with_XRC#wxCheckBox XRC] = wxPython = <s...")
 
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''Documents'''
= XRC Example =
* [https://docs.wxpython.org/wx.CheckBox.html#wx.CheckBox wxPython]
* [https://wiki.wxwidgets.org/Using_XML_Resources_with_XRC#wxCheckBox XRC]


= wxPython =
=== Python ===
<source lang="python">
<source lang="python">
self.chk1 = wx.CheckBox(self, label='1')
im = wx.Image(image_stream)
self.chk1.SetValue(True)
bm = wx.Bitmap(im)
self.chk1.Bind(wx.EVT_CHECKBOX, self.OnCheck)
sb = wx.xrc.XRCCTRL(self.frame, 'name_of_wxsb', 'wxStaticBitmap')
sb.SetBitmap(bm)
</source>
</source>


= XRC =
=== XRC ===
<source lang="xml">
<source lang="xml">
<object class="wxCheckBox" name="checkbox_id">
<object name="name_of_wxsb" class="wxStaticBitmap">
   <size>200,50</size>
   <size>200,60</size>
  <label>CheckBoxItem</label>
  <checked>1</checked>
</object>
</object>
</source>
</source>
= Programmatically Example =
<source lang="python">
# TODO
</source>
= Documents =
* [https://docs.wxpython.org/wx.StaticBitmap.html wxPython]
* [https://wiki.wxwidgets.org/Using_XML_Resources_with_XRC#wxStaticText XRC]
* [https://docs.wxpython.org/wx.Image.html wxImage]
* [https://docs.wxpython.org/wx.Bitmap.html wxBitmap]

Latest revision as of 09:48, 4 December 2019

XRC Example

Python

im = wx.Image(image_stream)
bm = wx.Bitmap(im)
sb = wx.xrc.XRCCTRL(self.frame, 'name_of_wxsb', 'wxStaticBitmap')
sb.SetBitmap(bm)

XRC

<object name="name_of_wxsb" class="wxStaticBitmap">
  <size>200,60</size>
</object>

Programmatically Example

# TODO

Documents