Example #1
0
    def make_editor(self, col_style=wx.LIST_FORMAT_LEFT):
        editor = wx.PreTextCtrl()

        style = wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB | wx.TE_RICH2
        style |= {
            wx.LIST_FORMAT_LEFT: wx.TE_LEFT,
            wx.LIST_FORMAT_RIGHT: wx.TE_RIGHT,
            wx.LIST_FORMAT_CENTRE: wx.TE_CENTRE
        }[col_style]

        editor.Create(self, -1, style=style)
        editor.SetBackgroundColour(self.editorBgColour)
        editor.SetForegroundColour(self.editorFgColour)
        font = self.GetFont()
        editor.SetFont(font)

        self.curRow = 0
        self.curCol = 0

        editor.Hide()
        self.editor = editor

        self.col_style = col_style
        self.editor.Bind(wx.EVT_CHAR, self.OnChar)
        self.editor.Bind(wx.EVT_KILL_FOCUS, self.CloseEditor)
 def on_hide_characters_checkbox(self, event):
     hide_characters = self.hide_characters_checkbox.GetValue()
     style = wx.TE_PASSWORD if hide_characters else 0
     value = self.passphrase_textctrl.GetValue()
     new_passphrase_textctrl = wx.PreTextCtrl()
     #create hidden to prevent visible repositionning
     new_passphrase_textctrl.Show(False)
     new_passphrase_textctrl.Create(self,
                                    -1,
                                    "",
                                    size=(250, -1),
                                    style=style)
     new_passphrase_textctrl.SetValue(value)
     self.formsizer.Replace(self.passphrase_textctrl,
                            new_passphrase_textctrl)
     self.passphrase_textctrl.Destroy()
     self.passphrase_textctrl = new_passphrase_textctrl
     new_passphrase_textctrl.Show(True)
     self.formsizer.Layout()
Example #3
0
 def __init__(self):
     pre = wx.PreTextCtrl()
     self.PostCreate(pre)
     self.Bind(self._firstEventType, self.OnCreate)