[wxPython] wxStaticText

B

Bernd Kaiser

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

How can i make a wxStaticText markable?

Regards,
Bernd Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3-nr1 (Windows 2000)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFA5uv1P5/DfVjaYqcRAtyAAJ0So/if+RLqW32T/0SZfjJWhRJiqwCffzDp
2VBbhRFlxQtcyezpiBDBCyU=
=GJX8
-----END PGP SIGNATURE-----
 
B

Bernd Kaiser

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Greg Krohn wrote:
| Bernd Kaiser wrote:
|> How can i make a wxStaticText markable?
|
| What do you mean by markable?
|
| greg

Oh sorry,
I mean selectable, so you can select the text with the mouse.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3-nr1 (Windows 2000)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFA5u1zP5/DfVjaYqcRAtEgAJ9eKKjwZIKrLLhRKTBp4clypIoCywCgix4y
Ys/mmFTDse7vW0D1hG2SmGI=
=mOqU
-----END PGP SIGNATURE-----
 
G

Greg Krohn

Bernd said:
I mean selectable, so you can select the text with the mouse.

I would use a TextCtrl. You can set it's style to read-only if all you
really want is selectable text which can't be edited by the user. Or if
you DO want it to resemble a StaticText, also remove the border style
and change the background Colour. The only apparent downside of this
approach is you still get a blinking cursor (at least on WinXP).


import wx

app = wx.PySimpleApp()
frame = wx.Frame(None, -1, "Test")

panel = wx.Panel(frame, -1)
sizer = wx.BoxSizer(wx.VERTICAL)
panel.SetSizer(sizer)

label1 = wx.TextCtrl(panel, -1, "Read-only", style=wx.TE_READONLY)
sizer.Add(label1, 0, flag=wx.EXPAND|wx.ALL, border=10)

label2 = wx.TextCtrl(panel, -1,
"Read-only + No Border + Change BG Color",
style=wx.TE_READONLY|wx.NO_BORDER)
label2.SetBackgroundColour(panel.GetBackgroundColour())
sizer.Add(label2, 0, flag=wx.EXPAND|wx.ALL, border=10)

frame.Show(True)
app.MainLoop()


hth,
greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top