Welcome to Binary Clock Software’s documentation!¶
Binary Clock Python API¶
API functions for interfacing with the Binary Clock
BinaryClockAPI Class¶
-
class
binaryClockAPI.
BinaryClockAPI
(serial_port, baud=250000)[source]¶ Main class that handles communication and exposes functions to be called.
Parameters: - serial_port (str) – Serial port to connect to. (e.g. “/dev/tty.usbserial-12345”)
- baud (int) – baudrate to communicate at (default: 250000)
-
clear_LED
(row, column)[source]¶ Clear an LED at the given co-ordinates.
Parameters: - row (int) – Row of the LED to clear
- column (int) – Column of the LED to clear
-
set_LED
(row, column, red, green, blue)[source]¶ Set an LED to the given color.
Parameters: - row (int) – Row of the LED to set
- column (int) – Column of the LED to set
- red (int) – Red value (0 - 255)
- green (int) – Green value (0 - 255)
- blue (int) – Blue value (0 - 255)
-
set_all_LEDs
(red, green, blue)[source]¶ Sets all LEDs to the given color.
Parameters: - red (int) – Red value (0 - 255)
- green (int) – Green value (0 - 255)
- blue (int) – Blue value (0 - 255)
-
set_color
(red, green, blue)[source]¶ Sets the active colors when running in time mode.
Parameters: - red (int) – Red value (0 - 255)
- green (int) – Green value (0 - 255)
- blue (int) – Blue value (0 - 255)
-
set_state
(state)[source]¶ Sets the current state of the device. (either time control or manual control)
Parameters: state (int) – Can either be 0 (RUN TIME) or 1 (RUN MANUAL)
-
update_time
(time_override_arr=None)[source]¶ Function for updating the time displayed on the clock. By default, uses time.localtime() function to grab the current time from your computer.
Parameters: time_override_arr (list) – List (in the format [hour, min, sec]) if you want to override the local time on your machine.
Binary Clock GUI¶
GUI for the Binary Clock API.
BinaryClockGUI Class¶
-
class
binaryClockGUI.
BinaryClockGUI
[source]¶ Binary Clock GUI Object
-
disconnect
(raise_error_dialog=True)[source]¶ Disconnect the binary clock by closing communication, deleting the binaryClock object, and resetting the GUI elements to the disconnected state.
-
GUI Helper Functions¶
Custom wrappers around Tkinter classes & functions.
CheckBox Class¶
-
class
CustomGUIWrappers.
CheckBox
(master, row, column, callback_funct=None, cb_text=”, padx=3, pady=3, columnspan=1)[source]¶ Class for creating a checkbox. Used when you need a boolean decision from the user.
Parameters: - master – This is the root variable of the GUI. (tk.TK())
- row (int) – what row the check box is put into.
- column (int) – what column the check box is put into.
- true_callback_funct (funct) – This function is called when the box is checked by the user.
- false_callback_funct (funct) – This function is called when the box is unchecked by the user.
- cb_text (str) – this is the label for the check box. [default: “”]
- padx (int) – This is how much x axis padding is given to the check box. [default: 3 px]
- pady (int) – This is how much y axis padding is given to the check box. [default: 3 px]
EntryBox Class¶
-
class
CustomGUIWrappers.
EntryBox
(master, row, column, default_val=”, **kwargs)[source]¶ Class for creating an Entry box. Used when you need a string input from the user.
Parameters: - master – This is the root variable of the GUI. (tk.TK())
- row (int) – what row the entry box is put into.
- column (int) – what column the entry box is put into.
- default_val (str) – String that first populates the box. [default: “”]
- **padx (int) – This is how much x axis padding is given to the entry box. [default: 3 px]
- **pady (int) – This is how much y axis padding is given to the entry box. [default: 3 px]
- **box_width (int) – Sets how wide the input box is [default: 20 px]
- **state (str) – Sets the state of the entry box (disabled, readonly, etc.) [default: “active”]
- **sticky – Sets which side of the cell the Entry box sticks to. (e.g. tk.E) [default: “”]
- **justify – Sets how the text in the Entry box aligns. [default: tk.LEFT]
Dropdown Class¶
-
class
CustomGUIWrappers.
Dropdown
(master, row, column, *options, **kwargs)[source]¶ Class for creating a Dropdown menu. Used when you need an option from a fixed list the user.
Parameters: - master – This is the root variable of the GUI. (tk.TK())
- row (int) – what row the dropdown is put into.
- column (int) – what column the dropdown is put into.
- *values (list) – String list that populates the options.
- **padx (int) – This is how much x axis padding is given to the dropdown box. [default: 3 px]
- **pady (int) – This is how much y axis padding is given to the dropdown box. [default: 3 px]
- **sticky (int) – Sets where the dropdown box populates in it’s cell. [default: None]
- **columnspan (int) – Sets how many columns the label spans. [default: 1]
- **trace_callback (funct) – Callback function for when the dropdown variable has been changed. [default: None]
- **bind_callback (funct) – Callback function binded to the key bind_key. [default: None]
- **bind_key (str) – Key that binds the function bind_callback. [default: None]
Labels Class¶
-
class
CustomGUIWrappers.
Labels
(master, row, column, label, **kwargs)[source]¶ Class for the various labels in the GUI. useful so we can forget & remember them when we need them to be invisable or visable, respectively.
Parameters: - master – This is the root variable of the GUI. (tk.TK())
- row (int) – what row the label is put into.
- column (int) – what column the label is put into.
- default_val (str) – String that first populates the box. [default: “”]
- **padx (int) – This is how much x axis padding is given to the check box. [default: 3 px]
- **pady (int) – This is how much y axis padding is given to the check box. [default: 0 px]
- **columnspan (int) – Sets how many columns the label spans. [default: 1]
- **sticky (int) – Sets where the dropdown box populates in it’s cell. [default: None]
ScrollBox Class¶
-
class
CustomGUIWrappers.
ScrollBox
(master, row, column, min_val, max_val, start_val, **kwargs)[source]¶ Class for creating a scroll box. Used when you need an integer input from the user in a certain range.
Parameters: - master – This is the root variable of the GUI. (tk.TK())
- row (int) – what row the check box is put into.
- column (int) – what column the check box is put into.
- min_val (int) – Minimum value that the Scroll box can be.
- max_val (int) – Maximum value that the Scroll box can be.
- start_val (int) – Initial value of the box.
- **padx (int) – This is how much x axis padding is given to the check box. [default: 3 px]
- **pady (int) – This is how much y axis padding is given to the check box. [default: 3 px]
- **box_width (int) – Sets how wide the input box is [default: 19 px]
Button Class¶
-
class
CustomGUIWrappers.
Button
(master, row, column, callback, label, **kwargs)[source]¶ Class for creating an Entry box. Used when you need a string input from the user.
Parameters: - master – This is the root variable of the GUI. (tk.TK())
- row (int) – what row the check box is put into.
- column (int) – what column the check box is put into.
- min_val (int) – Minimum value that the Scroll box can be.
- max_val (int) – Maximum value that the Scroll box can be.
- start_val (int) – Initial value of the box.
- **padx (int) – This is how much x axis padding is given to the check box. [default: 3 px]
- **pady (int) – This is how much y axis padding is given to the check box. [default: 3 px]
- **columnspan (int) – Sets how many columns the label spans. [default: 1]
- **sticky (int) – Sets where the dropdown box populates in it’s cell. [default: None]
TimeEntry Class¶
-
class
CustomGUIWrappers.
TimeEntry
(master, row, column, padx=3, pady=3, default_val_dict={‘second’: 42, ’minute’: 30, ’hour’: 12})[source]¶ Class for creating a time enry box. Used when you need a time input from the user.
Parameters: - master – This is the root variable of the GUI. (tk.TK())
- row (int) – what row the check box is put into.
- column (int) – what column the check box is put into.
- default_val_dict (dict) – Dictionary of values that first populates the boxes. [default: {“hour”: 12, “minute”: 30, “second”: 42}]
- padx (int) – This is how much x axis padding is given to the check box. [default: 3 px]
- pady (int) – This is how much y axis padding is given to the check box. [default: 3 px]
- box_width (int) – Sets how wide the input box is [default: 20 px]