Hi all,
I'd like to ask, whether it is possible to suppress the alert sounds
on specific events.
I have some readonly text controls, where single keys may be used to
control the behaviour of the app.
The function itself is called in a char event, which works fine,
however, there is also an alert sound, while it is being typed to a
read-only widget.
Can this sound be somehow disabled/Vetoed from within wxpython?
The simplified sample can look like the following: the function is
successfully called on an char event, but there is an acoustic alert
suggesting rather a failure. (win XP, SP3)
Thanks in advance for any suggestions,
Vlasta
TextCtrl-Readonly-Char-evt.py (579 Bytes)
···
===================================================
#! Python
# -*- coding: utf-8 -*-
import wx
def check_first_line_visible(evt=None):
first_visible_line = testTxtCtrl.HitTest((0, 5))[2]
info_txt = u"top line: %s" % (first_visible_line,)
frm.SetTitle(info_txt)
evt.Skip()
appl = wx.App(redirect=False)
frm = wx.Frame(None, -1, "top line - ??")
testTxtCtrl = wx.TextCtrl(frm, -1, style=wx.TE_MULTILINE | wx.TE_RICH2
wx.TE_READONLY)
testTxtCtrl.SetValue("\n".join(str(x).zfill(3) for x in range(0,101)))
testTxtCtrl.Bind(wx.EVT_CHAR, check_first_line_visible)
frm.Show()
appl.MainLoop()