Example #1
0
    def tips(self):
        # Set up our tips
        font_title = wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD)
        font_text = wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL)
        shape = BT.BT_ROUNDED
        style = BT.BT_LEAVE
        self.tips = {}
        dict = settings["tips"]
        self.tips["Start"] = [
            BT.BalloonTip(topicon=None,
                          toptitle="Start button",
                          message=TipFormatter(dict["Start"]),
                          shape=shape,
                          tipstyle=style), self.start
        ]
        self.tips["Set"] = [
            BT.BalloonTip(topicon=None,
                          toptitle="Set button",
                          message=TipFormatter(dict["Set"]),
                          shape=shape,
                          tipstyle=style), self.set
        ]
        self.tips["Textbox"] = [
            BT.BalloonTip(topicon=None,
                          toptitle="Sampling interval",
                          message=TipFormatter(dict["Textbox"]),
                          shape=shape,
                          tipstyle=style), self.rate
        ]
        self.tips["Reading"] = [
            BT.BalloonTip(topicon=None,
                          toptitle="Reading",
                          message=TipFormatter(dict["Reading"]),
                          shape=shape,
                          tipstyle=style), self.reading
        ]
        self.tips["Time stamp"] = [
            BT.BalloonTip(topicon=None,
                          toptitle="Time stamp",
                          message=TipFormatter(dict["Time stamp"]),
                          shape=shape,
                          tipstyle=style), self.timestamp
        ]

        for name in self.tips:
            self.tips[name][0].SetBalloonColour(dict["tip bg color"])
            self.tips[name][0].SetMessageColour(dict["tip fg color"])
            self.tips[name][0].SetStartDelay(dict["start delay ms"])
            self.tips[name][0].SetTitleFont(font_title)
            self.tips[name][0].SetMessageFont(font_text)
            self.tips[name][0].SetTarget(self.tips[name][1])
Example #2
0
    def __init__(self, parent):
        wx.Frame.__init__(self, parent, -1, "BalloonTip Demo")

        # Attributes
        panel = wx.Panel(self)

        txtctrl = wx.TextCtrl(panel, -1, "I am a textctrl", pos=(100,100))

        bmp = wx.Bitmap('../image/critical.png', wx.BITMAP_TYPE_PNG)

        tipballoon = btip.BalloonTip(topicon=bmp, 
                            toptitle='textctrl', message='this is a textctrl',
                            shape=btip.BT_ROUNDED, tipstyle=btip.BT_LEAVE)
        
        # Set the BalloonTip target
        tipballoon.SetTarget(txtctrl)
        # Set the BalloonTip background colour
        tipballoon.SetBalloonColour(wx.WHITE)

        # Set the font for the balloon title
        tipballoon.SetTitleFont(wx.Font(9, wx.FONTFAMILY_SWISS, 
                                        wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False))
        # Set the colour for balloon title 
        tipballoon.SetTitleColour(wx.BLACK)

        # Leave the message font as default
        tipballoon.SetMessageFont()
        # Set message (tip) foreground colour
        tipballoon.SetMessageColour(wx.RED)

        # Set the start delay for the BalloonTip
        tipballoon.SetStartDelay(1000)
    def __init__(self, parent):

        wx.Frame.__init__(self, parent, -1, "BalloonTip Demo")

        panel = wx.Panel(self)

        # Let's suppose that in your application you have a wx.TextCtrl defined as:
        mytextctrl = wx.TextCtrl(panel, -1, "I am a textctrl", pos=(100, 100))

        # You can define your BalloonTip as follows:
        tipballoon = BT.BalloonTip(topicon=None,
                                   toptitle="textctrl",
                                   message="this is a textctrl",
                                   shape=BT.BT_ROUNDED,
                                   tipstyle=BT.BT_LEAVE)

        # Set the BalloonTip target
        tipballoon.SetTarget(mytextctrl)
        # Set the BalloonTip background colour
        tipballoon.SetBalloonColour(wx.WHITE)
        # Set the font for the balloon title
        tipballoon.SetTitleFont(
            wx.Font(9, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_BOLD, False))
        # Set the colour for the balloon title
        tipballoon.SetTitleColour(wx.BLACK)
        # Leave the message font as default
        tipballoon.SetMessageFont()
        # Set the message (tip) foreground colour
        tipballoon.SetMessageColour(wx.LIGHT_GREY)
        # Set the start delay for the BalloonTip
        tipballoon.SetStartDelay(1000)
        # Set the time after which the BalloonTip is destroyed
        tipballoon.SetEndDelay(3000)
Example #4
0
    def test_lib_agw_balloontipMethods(self):
        tip = BT.BalloonTip(toptitle='Balloon', message='Hello wxPython',
                            shape=BT.BT_ROUNDED, tipstyle=BT.BT_BUTTON)
        
        self.assertTrue(tip.GetBalloonShape() == BT.BT_ROUNDED)
        self.assertTrue(tip.GetBalloonTipStyle() == BT.BT_BUTTON)

        tip.SetBalloonShape(BT.BT_RECTANGLE)
        tip.SetBalloonTipStyle(BT.BT_LEAVE)
        self.assertTrue(tip.GetBalloonShape() == BT.BT_RECTANGLE)
        self.assertTrue(tip.GetBalloonTipStyle() == BT.BT_LEAVE)
Example #5
0
 def onHover(self, event):
     sel = self.listbox.GetSelection()
     if sel != -1:
         text = self.listbox.GetString(sel)
         tip = BT.BalloonTip(toptitle= "selected value", message = text,
                             tipstyle= BT.BT_LEAVE)
         tip.SetTarget(self)
         tip.SetBalloonColour(wx.WHITE)
         # Set the font for the balloon title
         tip.SetTitleFont(wx.Font(15, wx.FONTFAMILY_SWISS, \
                                      wx.FONTSTYLE_NORMAL, \
                                      wx.FONTWEIGHT_BOLD, False))
         # Set the colour for the balloon title
         tip.SetTitleColour(wx.BLACK)
         # Leave the message font as default
         tip.SetMessageFont(wx.Font(9, wx.FONTFAMILY_SWISS, \
                                    wx.FONTSTYLE_NORMAL, \
                                    wx.FONTWEIGHT_BOLD, False))
         # Set the message (tip) foreground colour
         tip.SetMessageColour(wx.BLUE)
Example #6
0
    def __init__(self):
        super(TaskBarBalloon, self).__init__()

        # Setup
        icon = wx.Icon("face-monkey.png", wx.BITMAP_TYPE_PNG)
        self.SetIcon(icon)

        # Setup BallooTip
        title="BalloonTip Recipe"
        msg = "Welcome to the Balloon Tip Recipe"
        bmp = wx.BitmapFromIcon(icon)
        self.tip = btip.BalloonTip(topicon=bmp,
                                   toptitle=title,
                                   message=msg,
                                   shape=btip.BT_ROUNDED,
                                   tipstyle=btip.BT_BUTTON)
        self.tip.SetStartDelay(1000)
        self.tip.SetTarget(self)

        # Event Handlers
        self.Bind(wx.EVT_MENU, self.OnMenu)
Example #7
0
 def test_lib_agw_balloontipCtor(self):
     tip = BT.BalloonTip(toptitle='Balloon', message='Hello wxPython',
                         shape=BT.BT_ROUNDED, tipstyle=BT.BT_BUTTON)