AGW Logo

agw_title BalloonTip

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

This is the main class implementation.

hierarchy Inheritance Diagram

Inheritance diagram for: BalloonTip

Inheritance diagram of BalloonTip


appearance Control Appearance


BalloonTip

BalloonTip


method_summary Methods Summary

__init__Default class constructor.
DestroyTimerThe destruction timer has expired.
EnableTipEnable/disable globally the BalloonTip.
GetBalloonColourReturns the BalloonTip background colour.
GetBalloonIconReturns the BalloonTip top-left icon.
GetBalloonMessageReturns the BalloonTip tip message.
GetBalloonShapeReturns the BalloonTip frame shape.
GetBalloonTipStyleReturns the BalloonTip tipstyle parameter.
GetBalloonTitleReturns the BalloonTip top title.
GetEndDelayReturns the delay time after which the BalloonTip is destroyed.
GetMessageColourReturns the colour for the tip message.
GetMessageFontReturns the font for the tip message.
GetStartDelayReturns the delay time after which the BalloonTip is created.
GetTargetReturns the target window for the BalloonTip.
GetTitleColourReturns the colour for the top title.
GetTitleFontReturns the font for the top title.
NotifyTimerThe creation timer has expired.
OnDestroyHandles the target destruction, specifically handling the wx.EVT_WINDOW_DESTROY
OnTaskBarMoveHandles the mouse motion inside the taskbar icon area.
OnWidgetEnterHandles the wx.EVT_ENTER_WINDOW for the target control/window and
OnWidgetLeaveHandles the wx.EVT_LEAVE_WINDOW for the target control/window.
OnWidgetMotionHandle the mouse motion inside the target.
SetBalloonColourSets the BalloonTip background colour.
SetBalloonIconSets the BalloonTip top-left icon.
SetBalloonMessageSets the BalloonTip tip message.
SetBalloonShapeSets the BalloonTip frame shape.
SetBalloonTipStyleSets the BalloonTip tipstyle parameter.
SetBalloonTitleSets the BalloonTip top title.
SetEndDelaySets the delay time after which the BalloonTip is destroyed.
SetMessageColourSets the colour for the tip message.
SetMessageFontSets the font for the tip message.
SetStartDelaySets the delay time after which the BalloonTip is created.
SetTargetSets the target control/window for the BalloonTip.
SetTitleColourSets the colour for the top title.
SetTitleFontSets the font for the top title.
TaskBarTimerThis timer check periodically the mouse position.

API Class API

class BalloonTip(object)[source]

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

This is the main class implementation.



__init__(topicon=None, toptitle="", message="", shape=BT_ROUNDED, tipstyle=BT_LEAVE)[source]

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:


    integer parameter settings
    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:


    integer parameter settings
    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()[source]

The destruction timer has expired. Destroys the BalloonTip frame.



EnableTip(enable=True)[source]

Enable/disable globally the BalloonTip.

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


GetBalloonColour()[source]

Returns the BalloonTip background colour.

Returns:An instance of wx.Colour.


GetBalloonIcon()[source]

Returns the BalloonTip top-left icon.

Returns:An instance of wx.Bitmap.


GetBalloonMessage()[source]

Returns the BalloonTip tip message.

Returns:A string containing the main message.


GetBalloonShape()[source]

Returns the BalloonTip frame shape.

Returns:An integer, one of BT_ROUNDED, BT_RECTANGLE.


GetBalloonTipStyle()[source]

Returns the BalloonTip tipstyle parameter.

Returns:An integer representing the style.


GetBalloonTitle()[source]

Returns the BalloonTip top title.

Returns:A string containing the top title.


GetEndDelay()[source]

Returns the delay time after which the BalloonTip is destroyed.

Returns:the delay time, in milliseconds.


GetMessageColour()[source]

Returns the colour for the tip message.

Returns:An instance of wx.Colour.


GetMessageFont()[source]

Returns the font for the tip message.

Returns:An instance of wx.Font.


GetStartDelay()[source]

Returns the delay time after which the BalloonTip is created.

Returns:the delay time, in milliseconds.


GetTarget()[source]

Returns the target window for the BalloonTip.

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


GetTitleColour()[source]

Returns the colour for the top title.

Returns:An instance of wx.Colour.


GetTitleFont()[source]

Returns the font for the top title.

Returns:An instance of wx.Font.


NotifyTimer()[source]

The creation timer has expired. Creates the BalloonTip frame.



OnDestroy(event)[source]

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

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


OnTaskBarMove(event)[source]

Handles the mouse motion inside the taskbar icon area.

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


OnWidgetEnter(event)[source]

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

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



OnWidgetLeave(event)[source]

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

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

Note

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



OnWidgetMotion(event)[source]

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 wx.MouseEvent event to be processed.



SetBalloonColour(colour=None)[source]

Sets the BalloonTip background colour.

Parameters:colour – a valid wx.Colour instance.



SetBalloonIcon(icon)[source]

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(message)[source]

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(shape=BT_ROUNDED)[source]

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(tipstyle=BT_LEAVE)[source]

Sets the BalloonTip tipstyle parameter.

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


integer parameter settings
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(title='')[source]

Sets the BalloonTip top title.

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


SetEndDelay(delay=1000000.0)[source]

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(colour=None)[source]

Sets the colour for the tip message.

Parameters:colour – a valid wx.Colour instance.



SetMessageFont(font=None)[source]

Sets the font for the tip message.

Parameters:font – a valid wx.Font instance.



SetStartDelay(delay=1)[source]

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(widget)[source]

Sets the target control/window for the BalloonTip.

Parameters:widget – any subclass of wx.Window.



SetTitleColour(colour=None)[source]

Sets the colour for the top title.

Parameters:colour – a valid wx.Colour instance.



SetTitleFont(font=None)[source]

Sets the font for the top title.

Parameters:font – a valid wx.Font instance.



TaskBarTimer()[source]

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.

Tree

Table Of Contents

Previous topic

BalloonFrame

Next topic

SVN Revision 68362 For balloontip