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¶
Control Appearance¶
Methods Summary¶
Default class constructor. |
|
The destruction timer has expired. Destroys the |
|
Enable/disable globally the |
|
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
|
Returns the |
|
Returns the delay time after which the |
|
Returns the colour for the tip message. |
|
Returns the font for the tip message. |
|
Returns the delay time after which the |
|
Returns the target window for the |
|
Returns the colour for the top title. |
|
Returns the font for the top title. |
|
The creation timer has expired. Creates the |
|
Handles the target destruction, specifically handling the |
|
Handles the mouse motion inside the taskbar icon area. |
|
Handles the |
|
Handles the |
|
Handle the mouse motion inside the target. |
|
Sets the |
|
Sets the |
|
Sets the |
|
Sets the |
|
Sets the |
|
Sets the |
|
Sets the delay time after which the BalloonTip is destroyed. |
|
Sets the colour for the tip message. |
|
Sets the font for the tip message. |
|
Sets the delay time after which the |
|
Sets the target control/window for the |
|
Sets the colour for the top title. |
|
Sets the font for the top title. |
|
This timer check periodically the mouse position. |
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
orNone
) – an icon that will be displayed on the top-left part of theBalloonTip
frame. If set toNone
, 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 onBalloonTip
.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 enableBalloonTip
,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.
See also
- 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.
- 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
.
- 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 theBalloonTip
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
, theBalloonTip
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. TheBalloonTip
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.
- 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
orBT_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 onBalloonTip
.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 isBT_LEAVE
, theBalloonTip
frame is destroyed.- Parameters:
event – a
wx.TimerEvent
to be processed.