-
Notifications
You must be signed in to change notification settings - Fork 11
/
WaterTag.py
54 lines (38 loc) · 1.45 KB
/
WaterTag.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# All works in this code have been curated by ECCC and licensed under the GNU General Public License v3.0.
# Read more: https://www.gnu.org/licenses/gpl-3.0.en.html
import wx
class WaterTag(wx.Panel):
def __init__(self, tag, message, siz, *args, **kwargs):
super(WaterTag, self).__init__(*args, **kwargs)
self.tag = tag
self.message = message
self.size = siz
self.InitUI()
def InitUI(self):
layoutSizer = wx.BoxSizer(wx.VERTICAL)
headerSizer = wx.BoxSizer(wx.HORIZONTAL)
self.noteHeader = wx.StaticText(self, label=self.tag, size= self.size, style=wx.ALIGN_CENTRE_HORIZONTAL)
headerSizer.Add(self.noteHeader, 1, wx.EXPAND)
if self.message != "":
messageButton = wx.Button(self, label="!", size=(14, 18))
messageButton.SetForegroundColour(wx.RED)
messageButton.Bind(wx.EVT_BUTTON, self.hint)
headerSizer.Add(messageButton)
layoutSizer.Add(headerSizer, 1, wx.EXPAND)
self.SetSizer(layoutSizer)
def hint(self, event):
dlg = wx.MessageDialog(self, self.message, 'Hint', wx.OK)
res = dlg.ShowModal()
if res == wx.ID_OK:
dlg.Destroy()
else:
dlg.Destroy()
return
def main():
app = wx.App()
frame = wx.Frame(None)
WaterTag("DEBUG", frame)
frame.Show()
app.MainLoop()
if __name__ == "__main__":
main()