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
|
class WidgetRichText(rt.RichTextCtrl):
def __init__(self, parent,size):
rt.RichTextCtrl.__init__(self,parent,-1,size=size)
#rt.RichTextCtrl(parent, size)
def WriteText(self,text):
wx.CallAfter(self.SetFocus)
self.Freeze()
self.BeginTextColour((255, 0, 0))
rt.RichTextCtrl.WriteText(self,"class WidgetRichText")
self.EndTextColour()
self.Thaw()
class Fentre_prin(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, -1, title)
### ma_scroll_window :
ma_scroll_window = wx.ScrolledWindow(self)
ma_scroll_window.SetBackgroundColour(wx.WHITE)
ma_scroll_window.SetScrollbars(20, 20, 55, 40)
### Bouton :
b1 = wx.Button(ma_scroll_window, -1, u"Quitter")
self.Bind(wx.EVT_BUTTON, self.quitter, b1)
### RichTextCtrl :
myrichtext1 = WidgetRichText(ma_scroll_window,size=(700,400))
myrichtext1.WriteText('class Fentre_prin')
# Création du sizer et positionnement des wigets :
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(b1, 0, wx.ALL, 5)
sizer.Add(myrichtext1, 0, wx.ALL, 5)
# Le sizer est lié au conteneur :
ma_scroll_window.SetSizer(sizer)
ma_scroll_window.Layout()
def quitter(self, evt):
self.Close() |
Partager