Skip to content

Commit e99e76b

Browse files
dogeekRedFantom
authored andcommitted
Rename Balloon widget to Tooltip
1 parent acb372d commit e99e76b

8 files changed

Lines changed: 28 additions & 32 deletions

File tree

AUTHORS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This file contains a list of all the authors of widgets in this repository. Plea
88
* `ScrolledListbox`
99
* `FontChooser`, based on an idea by [Nelson Brochado](https://www.github.com/nbro)
1010
* `FontSelectFrame`
11-
* `Balloon`
11+
* `Tooltip`
1212
* `ItemsCanvas`
1313
* `TimeLine`
1414
- The Python Team

docs/source/authors.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ List of all the authors of widgets in this repository. Please note that this lis
1111
* :class:`~ttkwidgets.ScrolledListbox`
1212
* :class:`~ttkwidgets.font.FontChooser`, based on an idea by `Nelson Brochado <https://www.github.com/nbro>`_
1313
* :class:`~ttkwidgets.font.FontSelectFrame`
14-
* :class:`~ttkwidgets.frames.Balloon`
14+
* :class:`~ttkwidgets.frames.Tooltip`
1515
* :class:`~ttkwidgets.ItemsCanvas`
1616
* :class:`~ttkwidgets.TimeLine`
1717

docs/source/ttkwidgets/ttkwidgets.frames.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ ttkwidgets.frames
1111
:nosignatures:
1212
:toctree: ttkwidgets.frames
1313

14-
Balloon
14+
Tooltip
1515
ScrolledFrame
1616
ToggledFrame

docs/source/ttkwidgets/ttkwidgets.frames/ttkwidgets.frames.Balloon.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
Balloon
1+
Tooltip
22
=======
33

44
.. currentmodule:: ttkwidgets.frames
55

6-
.. autoclass:: Balloon
6+
.. autoclass:: Tooltip
77
:show-inheritance:
88
:members:
99

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22

33
# Copyright (c) RedFantom 2017
44
# For license see LICENSE
5-
from ttkwidgets.frames import Balloon
6-
try:
7-
import Tkinter as tk
8-
import ttk
9-
except ImportError:
10-
import tkinter as tk
11-
from tkinter import ttk
5+
from ttkwidgets import Tooltip
6+
import tkinter as tk
7+
from tkinter import ttk
128

139

1410
window = tk.Tk()
1511
button = tk.Button(window, text="Button", command=window.destroy)
1612
button.pack()
17-
balloon = Balloon(button)
13+
balloon = Tooltip(button)
1814
window.mainloop()

tests/test_balloon.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
License: GNU GPLv3
44
Source: This repository
55
"""
6-
from ttkwidgets.frames import Balloon
6+
from ttkwidgets.frames import Tooltip
77
from ttkwidgets.utilities import parse_geometry_string
88
from tests import BaseWidgetTest
99
try:
@@ -13,24 +13,24 @@
1313
from time import sleep
1414

1515

16-
class TestBalloon(BaseWidgetTest):
16+
class TestTooltip(BaseWidgetTest):
1717
def test_balloon_init(self):
18-
balloon = Balloon(self.window)
18+
balloon = Tooltip(self.window)
1919
self.window.update()
2020

2121
def test_balloon_kwargs(self):
22-
balloon = Balloon(self.window, headertext="Help", text="This is a test for the Balloon widget.", width=300,
22+
balloon = Tooltip(self.window, headertext="Help", text="This is a test for the Tooltip widget.", width=300,
2323
timeout=2, background="white", showheader=True, offset=(20, 20), static=True)
2424
self.assertEqual(balloon.cget("headertext"), "Help")
25-
self.assertEqual(balloon.cget("text"), "This is a test for the Balloon widget.")
25+
self.assertEqual(balloon.cget("text"), "This is a test for the Tooltip widget.")
2626
self.assertEqual(balloon.cget("width"), 300)
2727
self.assertEqual(balloon.cget("timeout"), 2)
2828
self.assertEqual(balloon.cget("background"), "white")
2929

30-
balloon.config(headertext="New Help", text="This is another test for the Balloon widget.", width=400,
30+
balloon.config(headertext="New Help", text="This is another test for the Tooltip widget.", width=400,
3131
timeout=3, background="black")
3232
self.assertEqual(balloon["headertext"], "New Help")
33-
self.assertEqual(balloon["text"], "This is another test for the Balloon widget.")
33+
self.assertEqual(balloon["text"], "This is another test for the Tooltip widget.")
3434
self.assertEqual(balloon["width"], 400)
3535
self.assertEqual(balloon["timeout"], 3)
3636
self.assertEqual(balloon["background"], "black")
@@ -70,7 +70,7 @@ def test_balloon_kwargs(self):
7070
self.assertFalse(x2 == x3 or y2 == y3)
7171

7272
def test_balloon_show(self):
73-
balloon = Balloon(self.window)
73+
balloon = Tooltip(self.window)
7474
self.window.update()
7575
balloon.show()
7676
self.window.update()
@@ -82,7 +82,7 @@ def test_balloon_show(self):
8282
self.assertIs(balloon._toplevel, None)
8383

8484
def test_balloon_events(self):
85-
balloon = Balloon(self.window, timeout=0.2)
85+
balloon = Tooltip(self.window, timeout=0.2)
8686
balloon._on_enter(None)
8787
self.window.update()
8888
sleep(0.3)
@@ -92,6 +92,6 @@ def test_balloon_events(self):
9292
self.assertIs(balloon._toplevel, None)
9393

9494
def test_balloon_events_noshow(self):
95-
balloon = Balloon(self.window)
95+
balloon = Tooltip(self.window)
9696
balloon._on_enter(None)
9797
balloon._on_leave(None)

ttkwidgets/frames/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# Available under the license found in LICENSE
33
from .scrolledframe import ScrolledFrame
44
from .toggledframe import ToggledFrame
5-
from .balloon import Balloon
5+
from .tooltip import Tooltip
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,25 @@
1414
from ttkwidgets.utilities import get_assets_directory
1515

1616

17-
class Balloon(ttk.Frame):
17+
class Tooltip(ttk.Frame):
1818
"""Simple help hover balloon."""
1919

2020
def __init__(self, master=None, headertext="Help", text="Some great help is displayed here.", width=200, timeout=1,
2121
background="#fef9cd", offset=(2, 2), showheader=True, static=False, **kwargs):
2222
"""
23-
Create a Balloon
23+
Create a Tooltip
2424
25-
:param master: widget to bind the Balloon to
25+
:param master: widget to bind the Tooltip to
2626
:type master: widget
2727
:param headertext: text to show in window header
2828
:type headertext: str
2929
:param text: text to show as help text
3030
:type text: str
3131
:param width: width of the window
3232
:type width: int
33-
:param timeout: timeout in seconds to wait until the Balloon is shown
33+
:param timeout: timeout in seconds to wait until the Tooltip is shown
3434
:type timeout: float
35-
:param background: background color of the Balloon
35+
:param background: background color of the Tooltip
3636
:type background: str
3737
:param offset: The offset from the mouse position the Ballon shows up
3838
:type offset: Tuple[int, int]
@@ -102,7 +102,7 @@ def show(self):
102102
Create the Toplevel and its children to show near the cursor
103103
104104
This is the callback for the delayed :obj:`<Enter>` event
105-
(see :meth:`~Balloon._on_enter`).
105+
(see :meth:`~Tooltip._on_enter`).
106106
"""
107107
self._toplevel = tk.Toplevel(self.master)
108108
self._canvas = tk.Canvas(self._toplevel, background=self.__background)
@@ -134,7 +134,7 @@ def cget(self, key):
134134
:return: value of the option
135135
136136
To get the list of options for this widget, call the method
137-
:meth:`~Balloon.keys`.
137+
:meth:`~Tooltip.keys`.
138138
"""
139139
if key == "headertext":
140140
return self.__headertext
@@ -160,7 +160,7 @@ def config(self, **kwargs):
160160
Configure resources of the widget.
161161
162162
To get the list of options for this widget, call the method
163-
:meth:`~Balloon.keys`. See :meth:`~Balloon.__init__` for a
163+
:meth:`~Tooltip.keys`. See :meth:`~Tooltip.__init__` for a
164164
description of the widget specific option.
165165
"""
166166
self.__headertext = kwargs.pop("headertext", self.__headertext)

0 commit comments

Comments
 (0)