Phoenix Logo

phoenix_title wx.lib.agw.balloontip.BalloonTip

BalloonTip is a class that allows you to display tooltips in a balloon style window.

This is the main class implementation.


class_hierarchy Class Hierarchy

Inheritance diagram for class BalloonTip:


appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


method_summary Methods Summary

__init__ Default class constructor.
DestroyTimer The destruction timer has expired. Destroys the BalloonTip frame.
EnableTip Enable/disable globally the BalloonTip.
GetBalloonColour Returns the BalloonTip background colour.
GetBalloonIcon Returns the BalloonTip top-left icon.
GetBalloonMessage Returns the BalloonTip tip message.
GetBalloonShape Returns the BalloonTip frame shape.
GetBalloonTipStyle Returns the BalloonTip tipstyle parameter.
GetBalloonTitle Returns the BalloonTip top title.
GetEndDelay Returns the delay time after which the BalloonTip is destroyed.
GetMessageColour Returns the colour for the tip message.
GetMessageFont Returns the font for the tip message.
GetStartDelay Returns the delay time after which the BalloonTip is created.
GetTarget Returns the target window for the BalloonTip.
GetTitleColour Returns the colour for the top title.
GetTitleFont Returns the font for the top title.
NotifyTimer The creation timer has expired. Creates the BalloonTip frame.
OnDestroy Handles the target destruction, specifically handling the wx.EVT_WINDOW_DESTROY
OnTaskBarMove Handles the mouse motion inside the taskbar icon area.
OnWidgetEnter Handles the wx.EVT_ENTER_WINDOW for the target control/window and
OnWidgetLeave Handles the wx.EVT_LEAVE_WINDOW for the target control/window.
OnWidgetMotion Handle the mouse motion inside the target.
SetBalloonColour Sets the BalloonTip background colour.
SetBalloonIcon Sets the BalloonTip top-left icon.
SetBalloonMessage Sets the BalloonTip tip message.
SetBalloonShape Sets the BalloonTip frame shape.
SetBalloonTipStyle Sets the BalloonTip tipstyle parameter.
SetBalloonTitle Sets the BalloonTip top title.
SetEndDelay Sets the delay time after which the BalloonTip is destroyed.
SetMessageColour Sets the colour for the tip message.
SetMessageFont Sets the font for the tip message.
SetStartDelay Sets the delay time after which the BalloonTip is created.
SetTarget Sets the target control/window for the BalloonTip.
SetTitleColour Sets the colour for the top title.
SetTitleFont Sets the font for the top title.
TaskBarTimer This timer check periodically the mouse position.

api Class API



class BalloonTip(object)

BalloonTip is a class that allows you to display tooltips in a balloon style window.

This is the main class implementation.


Methods



__init__(self, topicon=None, toptitle="", message="", shape=BT_ROUNDED, tipstyle=BT_LEAVE)

Default class constructor.

Parameters:
  • topicon (wx.Bitmap or None) – an icon that will be displayed on the top-left part of the BalloonTip frame. If set to None, no icon will be displayed;
  • toptitle (string) – a title that will be displayed on the top part of the BalloonTip frame. If set to an empty string, no title will be displayed;
  • message (string) – the tip message that will be displayed. It can not be set to an empty string;
  • shape (integer) – the BalloonTip shape. It can be one of the following:

    Shape Flag Hex Value Description
    BT_ROUNDED 0x1 BalloonTip will have a rounded rectangular shape.
    BT_RECTANGLE 0x2 BalloonTip will have a rectangular shape.
  • tipstyle (integer) – the BalloonTip destruction behavior. It can be one of:

    Tip Flag Hex Value Description
    BT_LEAVE 0x3 BalloonTip will be destroyed when the user moves the mouse outside the target window.
    BT_CLICK 0x4 BalloonTip will be destroyed when the user click on BalloonTip.
    BT_BUTTON 0x5 BalloonTip will be destroyed when the user click on the close button.
Raise:

Exception in the following cases:

  • The message parameter is an empty string;
  • The shape parameter has an invalid value (i.e., it’s not one of BT_ROUNDED, BT_RECTANGLE);
  • The tipstyle parameter has an invalid value (i.e., it’s not one of BT_LEAVE, BT_CLICK, BT_BUTTON).


DestroyTimer(self, event)

The destruction timer has expired. Destroys the BalloonTip frame.

Parameters:event – a wx.TimerEvent to be processed.


EnableTip(self, enable=True)

Enable/disable globally the BalloonTip.

Parameters:enable (bool) – True to enable BalloonTip, False otherwise.


GetBalloonColour(self)

Returns the BalloonTip background colour.

Returns:An instance of wx.Colour.


GetBalloonIcon(self)

Returns the BalloonTip top-left icon.

Returns:An instance of wx.Bitmap.


GetBalloonMessage(self)

Returns the BalloonTip tip message.

Returns:A string containing the main message.


GetBalloonShape(self)

Returns the BalloonTip frame shape.

Returns:An integer, one of BT_ROUNDED, BT_RECTANGLE.


GetBalloonTipStyle(self)

Returns the BalloonTip tipstyle parameter.

Returns:An integer representing the style.


GetBalloonTitle(self)

Returns the BalloonTip top title.

Returns:A string containing the top title.


GetEndDelay(self)

Returns the delay time after which the BalloonTip is destroyed.

Returns:the delay time, in milliseconds.


GetMessageColour(self)

Returns the colour for the tip message.

Returns:An instance of wx.Colour.


GetMessageFont(self)

Returns the font for the tip message.

Returns:An instance of wx.Font.


GetStartDelay(self)

Returns the delay time after which the BalloonTip is created.

Returns:the delay time, in milliseconds.


GetTarget(self)

Returns the target window for the BalloonTip.

Returns:An instance of wx.Window.
Raise:Exception if the SetTarget method has not previously called.


GetTitleColour(self)

Returns the colour for the top title.

Returns:An instance of wx.Colour.


GetTitleFont(self)

Returns the font for the top title.

Returns:An instance of wx.Font.


NotifyTimer(self, event)

The creation timer has expired. Creates the BalloonTip frame.

Parameters:event – a wx.TimerEvent to be processed.


OnDestroy(self, event)

Handles the target destruction, specifically handling the wx.EVT_WINDOW_DESTROY event.

Parameters:event – a wx.WindowDestroyEvent event to be processed.


OnTaskBarMove(self, event)

Handles the mouse motion inside the taskbar icon area.

Parameters:event – a MouseEvent event to be processed.


OnWidgetEnter(self, event)

Handles the wx.EVT_ENTER_WINDOW for the target control/window and starts the BalloonTip timer for creation.

Parameters:event – a MouseEvent event to be processed.


OnWidgetLeave(self, event)

Handles the wx.EVT_LEAVE_WINDOW for the target control/window.

Parameters:event – a MouseEvent event to be processed.

Note

If the BalloonTip tipstyle is set to BT_LEAVE, the BalloonTip is destroyed.



OnWidgetMotion(self, event)

Handle the mouse motion inside the target.

This prevents the annoying behavior of BalloonTip to display when the user does something else inside the window. The BalloonTip window is displayed only when the mouse does not move for the start delay time.

Parameters:event – a MouseEvent event to be processed.


SetBalloonColour(self, colour=None)

Sets the BalloonTip background colour.

Parameters:colour – a valid wx.Colour instance.


SetBalloonIcon(self, icon)

Sets the BalloonTip top-left icon.

Parameters:icon – an instance of wx.Bitmap.
Raise:Exception if the icon bitmap is not a valid wx.Bitmap.


SetBalloonMessage(self, message)

Sets the BalloonTip tip message.

Parameters:message (string) – a string identifying the main message body of BalloonTip.
Raise:Exception if the message is an empty string.

Note

The BalloonTip message should never be empty.



SetBalloonShape(self, shape=BT_ROUNDED)

Sets the BalloonTip frame shape.

Parameters:shape (integer) – should be one of BT_ROUNDED or BT_RECTANGLE.
Raise:Exception if the shape parameter is not a valid value (i.e., it’s not one of BT_ROUNDED, BT_RECTANGLE);


SetBalloonTipStyle(self, tipstyle=BT_LEAVE)

Sets the BalloonTip tipstyle parameter.

Parameters:tipstyle (integer) – one of the following bit set:

Tip Style Hex Value Description
BT_LEAVE 0x3 BalloonTip will be destroyed when the user moves the mouse outside the target window.
BT_CLICK 0x4 BalloonTip will be destroyed when the user click on BalloonTip.
BT_BUTTON 0x5 BalloonTip will be destroyed when the user click on the close button.
Raise:Exception if the tipstyle parameter has an invalid value (i.e., it’s not one of BT_LEAVE, BT_CLICK, BT_BUTTON).


SetBalloonTitle(self, title="")

Sets the BalloonTip top title.

Parameters:title (string) – a string to use as a BalloonTip title.


SetEndDelay(self, delay=1e6)

Sets the delay time after which the BalloonTip is destroyed.

Parameters:delay (integer) – the number of milliseconds after which BalloonTip is destroyed.
Raise:Exception if delay is less than 1 milliseconds.


SetMessageColour(self, colour=None)

Sets the colour for the tip message.

Parameters:colour – a valid wx.Colour instance.


SetMessageFont(self, font=None)

Sets the font for the tip message.

Parameters:font – a valid wx.Font instance.


SetStartDelay(self, delay=1)

Sets the delay time after which the BalloonTip is created.

Parameters:delay (integer) – the number of milliseconds after which BalloonTip is created.
Raise:Exception if delay is less than 1 milliseconds.


SetTarget(self, widget)

Sets the target control/window for the BalloonTip.

Parameters:widget – any subclass of wx.Window.


SetTitleColour(self, colour=None)

Sets the colour for the top title.

Parameters:colour – a valid wx.Colour instance.


SetTitleFont(self, font=None)

Sets the font for the top title.

Parameters:font – a valid wx.Font instance.


TaskBarTimer(self, event)

This timer check periodically the mouse position.

If the current mouse position is sufficiently far from the coordinates it had when entered the taskbar icon and the BalloonTip style is BT_LEAVE, the BalloonTip frame is destroyed.

Parameters:event – a wx.TimerEvent to be processed.