Skip to content

Commit

Permalink
Documentation and flake8 update
Browse files Browse the repository at this point in the history
  • Loading branch information
slightlynybbled committed May 3, 2018
1 parent 57ce621 commit f2032fc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
9 changes: 9 additions & 0 deletions docs/widget_groups.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,12 @@ The screenshot consists of three individual examples of ``KeyValueEntry`` widget

.. autoclass:: groups.MultiSlotFrame
:members:

``SevenSegment``
----------------

.. image:: img/seven-segment-display.png

.. autoclass:: groups.SevenSegment

.. autoclass:: gorups.SevenSegmentDisplay
24 changes: 16 additions & 8 deletions tk_tools/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,15 +1001,19 @@ class SevenSegment(tk.Frame):
:param parent: the tk parent frame
:param height: the widget height (defaults to 50)
:param digit_color: the digit color (tkinter color specifications apply, such as 'black' or '#ff0000')
:param background: the background color (tkinter color specifications apply, such as 'black' or '#ff0000')
:param digit_color: the digit color (tkinter
color specifications apply, such as 'black' or '#ff0000')
:param background: the background color (tkinter
color specifications apply, such as 'black' or '#ff0000')
"""
def __init__(self, parent, height=50, digit_color='black', background='white'):
def __init__(self, parent, height=50,
digit_color='black', background='white'):
self._parent = parent
self._color = digit_color
self._bg_color = background

super().__init__(self._parent, height=height, width=int(height / 2), background=self._bg_color)
super().__init__(self._parent, height=height, width=int(height / 2),
background=self._bg_color)

self.columnconfigure(0, weight=1)
self.columnconfigure(1, weight=1)
Expand Down Expand Up @@ -1153,10 +1157,13 @@ class SevenSegmentDigits(tk.Frame):
:param parent: the tk parent frame
:param height: the widget height (defaults to 50)
:param digit_color: the digit color (tkinter color specifications apply, such as 'black' or '#ff0000')
:param background: the background color (tkinter color specifications apply, such as 'black' or '#ff0000')
:param digit_color: the digit color (tkinter color
specifications apply, such as 'black' or '#ff0000')
:param background: the background color (tkinter color
specifications apply, such as 'black' or '#ff0000')
"""
def __init__(self, parent, digits=1, height=50, digit_color='black', background='white'):
def __init__(self, parent, digits=1, height=50,
digit_color='black', background='white'):
self._parent = parent
self._max_value = digits * 10 - 1

Expand Down Expand Up @@ -1224,4 +1231,5 @@ def set_value(self, value: str):
else:
digits[i].set_value(digit_value)
except IndexError:
raise ValueError('the value "{}" contains too many digits'.format(value))
raise ValueError('the value "{}" contains too '
'many digits'.format(value))

0 comments on commit f2032fc

Please sign in to comment.