User Interface (UI) toolsο
On this page
Create project UIο
Set machine learning hyperparameters UIο
- class simba.ui.machine_model_settings_ui.MachineModelSettingsPopUp(config_path)[source]ο
Bases:
simba.mixins.pop_up_mixin.PopUpMixin,simba.mixins.config_reader.ConfigReaderGUI window for specifying ML model training parameters.
SimBA ML settings frameο
SimBA tkinter methodsο
- simba.ui.tkinter_functions.CreateLabelFrameWithIcon(parent, header, icon_name, padx=None, pady=None, relief='solid', width=None, bg=None, font=('DejaVu Sans', 10, 'bold'), icon_link=<class 'tkinter.LabelFrame'>, tooltip_key=None)[source]ο
- class simba.ui.tkinter_functions.DropDownMenu(parent=None, dropdownLabel='', choice_dict=None, labelwidth='', com=None, val=None, **kw)[source]ο
Bases:
tkinter.FrameLegacy, use
simba.ui.tkinter_functions.SimBADropDown().
- class simba.ui.tkinter_functions.Entry_Box(parent, fileDescription='', labelwidth=None, label_bg_clr=None, status='normal', validation=None, trace=None, entry_box_width=None, entry_box_clr='white', img=None, value=None, bg_clr=None, label_font=('DejaVu Sans', 8), entry_font=('DejaVu Sans', 8), tooltip_key=None, justify='left', cmd=None, allow_blank=False, **kw)[source]ο
Bases:
tkinter.Frame- property entry_getο
- class simba.ui.tkinter_functions.FileSelect(parent=None, fileDescription='', color=None, title=None, lblwidth=None, file_types=None, bg_clr='white', dropdown=None, entry_width=20, status=None, lbl_icon=None, font=('DejaVu Sans', 8), initialdir=None, initial_path=None, tooltip_txt=None, tooltip_key=None, **kw)[source]ο
Bases:
tkinter.Frame- property file_pathο
- class simba.ui.tkinter_functions.FolderSelect(parent, folderDescription='', color=None, label_bg_clr=None, font=('DejaVu Sans', 8), title='', lblwidth=0, bg_clr='white', entry_width=20, lbl_icon=None, initialdir=None, tooltip_txt=None, tooltip_key=None, **kw)[source]ο
Bases:
tkinter.Frame- property folder_pathο
- class simba.ui.tkinter_functions.SimBADropDown(parent, dropdown_options, label=None, label_width=None, label_font=('DejaVu Sans', 8), label_bg_clr=None, dropdown_font_size=None, justify='center', img=None, dropdown_width=None, command=None, value=None, state=None, searchable=False, tooltip_txt=None, tooltip_key=None)[source]ο
Bases:
tkinter.FrameCreate a dropdown menu widget with optional searchable functionality.
This class creates a ttk.Combobox dropdown menu with a label, supporting both readonly and searchable modes. When searchable mode is enabled, users can type to filter the dropdown options.
- Parameters
Tk) (parent (Frame | Canvas | LabelFrame | Toplevel |) β The parent widget container.
Tuple[Any]) (dropdown_options (Iterable[Any] | List[Any] |) β List of options to display in the dropdown menu.
optional) (tooltip_key (str,) β Text label displayed next to the dropdown. Default: None.
optional) β Width of the label in characters. Default: None.
optional) β Font tuple for the label. Default: Formats.FONT_REGULAR.value.
optional) β Background color for the label. Default: None.
optional) β Font size for the dropdown text. Default: None.
(str) (justify) β Text justification in the dropdown (βleftβ, βcenterβ, βrightβ). Default: βcenterβ.
optional) β Width of the dropdown widget in characters. Default: None.
optional) β Callback function to execute when an option is selected. Default: None.
optional) β Initial selected value for the dropdown. Default: None.
optional) β Initial state of the dropdown (βnormalβ, βdisabledβ). Default: None.
(bool) (searchable) β If True, allows typing to filter dropdown options. Default: False.
optional) β Tooltip text to display on hover. Default: None.
optional) β Key for tooltip lookup in TOOLTIPS dictionary. For dictionary, see simba.assets.lookups.tooptips.json. Default: None.
- Example
>>> dropdown = SimBADropDown(parent=parent_frm, dropdown_options=['Option 1', 'Option 2', 'Option 3'], label='Select option:', searchable=True) >>> selected = dropdown.get_value()
- simba.ui.tkinter_functions.SimBALabel(parent, txt, txt_clr='black', bg_clr=None, hover_fg_clr=None, font=('DejaVu Sans', 8), hover_font=None, relief='flat', compound='left', justify=None, link=None, width=None, padx=None, pady=None, cursor=None, img=None, anchor=None, tooltip_key=None, hover_img=None)[source]ο
- simba.ui.tkinter_functions.SimBARadioButton(parent, txt, variable, txt_clr='black', font=('DejaVu Sans', 8), compound='left', img=None, enabled=True, tooltip_txt=None, value=False, cmd=None, cmd_kwargs=None)[source]ο
- class simba.ui.tkinter_functions.SimBAScaleBar(parent, label=None, label_width=None, orient='horizontal', length=200, value=95, showvalue=True, label_clr='black', lbl_font=('DejaVu Sans', 8), scale_font=('DejaVu Sans', 8, 'italic'), lbl_img=None, from_=- 1, resolution=1, to=100, tickinterval=None, troughcolor=None, activebackground=None, sliderrelief='flat')[source]ο
Bases:
tkinter.Frame
- class simba.ui.tkinter_functions.SimBASeperator(parent, color='black', orient='horizontal', cursor=None, borderwidth=None, takefocus=0, height=1, relief='flat')[source]ο
Bases:
tkinter.Frame
- simba.ui.tkinter_functions.SimbaButton(parent, txt, txt_clr='black', bg_clr='#f0f0f0', active_bg_clr=None, hover_bg_clr='#d1e0e0', hover_font=('DejaVu Sans', 8, 'bold'), font=('DejaVu Sans', 8), width=None, height=None, compound='left', img=None, cmd=None, cmd_kwargs=None, enabled=True, anchor='w', thread=False, tooltip_txt=None, tooltip_key=None)[source]ο
- simba.ui.tkinter_functions.SimbaCheckbox(parent, txt, txt_clr='black', bg_clr=None, txt_img=None, txt_img_location='right', font=('DejaVu Sans', 8), val=False, state='normal', indicatoron=True, cmd=None, tooltip_txt=None, tooltip_key=None)[source]ο
- class simba.ui.tkinter_functions.TwoOptionQuestionPopUp(question, option_one, option_two, title, link=None)[source]ο
Bases:
objectHelpe to create a two-option question tkinter pop up window (e.g., YES/NO).
- Parameters
question (str) β Question to present to the user. E.g.,
DO YOU WANT TO PROCEED?.option_one (str) β The first user option. E.g.,
YES.option_one β The second user option. E.g.,
NO.title (str) β The window titel in the top banner of the pop-up. E.g.,
A QUESTION FOR YOU!.link (Optional[str]) β If not None, then a link to documentation presenting background info about the user choices.
SimBA create user-defined pose config UIο
- class simba.ui.user_defined_pose_creator.PoseConfigCreator(pose_name, animal_cnt, img_path, bp_list, animal_id_int_list, circle_scale=None)[source]ο
Bases:
simba.mixins.plotting_mixin.PlottingMixinClass for creating user-defined pose-estimation pipeline in SimBA through a GUI interface.
See also
- Parameters
pose_name (str) β Name of the user-defined pose-estimation setting.
no_animals (str) β Number of animals in the user-defined pose-estimation setting.
img_path (str) β Path to image representation of user-defined pose-estimation setting
bp_list (List[str]) β Body-parts in the user-defined pose-estimation setting.
animal_id_int_list (List[int]) β Integers representing the animal ID which the body-parts belong to.
- Examples
>>> pose_config_creator = PoseConfigCreator(pose_name="My_test_config", no_animals=2, img_path='simba/splash_050122.png', bp_list=['Ear', 'Nose', 'Left_ear', 'Ear', 'Nose', 'Left_ear'], animal_id_int_list= [1, 1, 1, 2, 2, 2]) >>> pose_config_creator.launch()
SimBA set video info UIο
- class simba.ui.video_info_ui.VideoInfoTable(config_path, video_dir=None, video_info_path=None)[source]ο
Bases:
simba.mixins.config_reader.ConfigReader,simba.mixins.pop_up_mixin.PopUpMixinCreate GUI that allows users to modify resolutions, fps, and pixels-per-mm interactively of videos within the SimBA project. Data is stored within the project_folder/logs/video_info.csv file in the SimBA project.
- Parameters
config_path (Union[str, os.PathLike]) β path to SimBA project config file in Configparser format
video_dir (Union[str, os.PathLike]) β Optional path to directory with video files. If None, then read from the SimBA project as dictated by project config. Default None.
video_info_path (Optional[Union[str, os.PathLike]]) β Optional path to vide_info.csv file. If None, then read from the SimBA project as dictated by project config. Default None.
See also
- Example
>>> ui = VideoInfoTable(config_path=r"C: roubleshooting\mitra\project_folder\project_config.ini") >>> ui.run()
SimBA video timelapseο
- class simba.ui.video_timelaps.TimelapseSlider(video_path, frame_cnt=25, crop_ratio=50, padding=60, ruler_divisions=6, show_ruler=True, ruler_height=None, ruler_width=None, img_width=None, img_height=None, use_timestamps=True)[source]ο
Bases:
objectInteractive timelapse viewer with segment selection sliders.
Creates a Tkinter GUI window displaying a timelapse composite image generated from evenly-spaced frames across a video. Includes interactive sliders to select start and end times for video segments, with visual highlighting of the selected segment and frame previews.
- Parameters
video_path (Union[str, os.PathLike]) β Path to video file to create timelapse from.
frame_cnt (int) β Number of frames to include in timelapse composite. Default 25.
ruler_width (Optional[int]) β Width per frame in pixels. If None, calculated to match video width. Default None.
crop_ratio (Optional[int]) β Percentage of frame width to keep (0-100). Default 50.
padding (int) β Padding in pixels added to timelapse when ruler is shown. Default 60.
ruler_divisions (int) β Number of major divisions on time ruler. Default 6.
show_ruler (bool) β If True, display time ruler below timelapse. Default True.
ruler_height (int) β Height of ruler in pixels. Default 60.
use_timestamps (bool) β If True, display timestamps (HH:MM:SS) in labels and ruler. If False, display frame numbers. Default True.
- Example
>>> slider = TimelapseSlider(video_path='path/to/video.mp4', frame_cnt=25, crop_ratio=75) >>> slider.run() >>> # Use sliders to select segment, then access selected times and frames: >>> start_time = slider.get_start_time() # seconds (float) >>> end_time = slider.get_end_time() # seconds (float) >>> start_time_str = slider.get_start_time_str() # "HH:MM:SS" string >>> end_time_str = slider.get_end_time_str() # "HH:MM:SS" string >>> start_frame = slider.get_start_frame() # frame number (int) >>> end_frame = slider.get_end_frame() # frame number (int) >>> slider.close()
SimBA import pose frameο
- class simba.ui.import_pose_frame.ImportPoseFrame(parent_frm=None, config_path=None, idx_row=0, idx_column=0)[source]ο
Bases:
simba.mixins.config_reader.ConfigReader,simba.mixins.pop_up_mixin.PopUpMixin
- Parameters
parent_frm (Optional[Union[Frame, Canvas, LabelFrame, ttk.Frame]]) β Parent frame to insert the Import pose frame into. If None, one is created.
config_path (Optional[Union[str, os.PathLike]]) β
idx_row (Optional[int]) β The row in parent_frm to insert the Import pose frame into. Default: 0.
idx_column (Optional[int]) β The column in parent_frm to insert the Import pose frame into. Default: 0.
- Example
>>> _ = ImportPoseFrame(config_path='/Users/simon/Desktop/envs/simba/troubleshooting/two_black_animals_14bp/project_folder/project_config.ini') >>> _ = ImportPoseFrame(config_path=r"C: roubleshooting\simba_blob_project\project_folder\project_config.ini")
SimBA import videos frameο
- class simba.ui.import_videos_frame.ImportVideosFrame(parent_frm=None, config_path=None, idx_row=0, idx_column=0)[source]ο
Bases:
simba.mixins.pop_up_mixin.PopUpMixin,simba.mixins.config_reader.ConfigReader
- Parameters
parent_frm (Optional[Union[Frame, Canvas, LabelFrame, ttk.Frame]]) β Parent frame to insert the Import Videos frame into. If None, one is created.
config_path (Optional[Union[str, os.PathLike]]) β
idx_row (Optional[int]) β The row in parent_frm to insert the Videos frame into. Default: 0.
idx_column (Optional[int]) β The column in parent_frm to insert the Videos frame into. Default: 0.
- Example
>>> ImportVideosFrame(config_path='/Users/simon/Desktop/envs/simba/troubleshooting/two_black_animals_14bp/project_folder/project_config.ini')
SimBA get pixels per millimeter converstion UIο
- class simba.ui.px_to_mm_ui.GetPixelsPerMillimeterInterface(video_path, known_metric_mm, line_thickness=None, circle_size=None)[source]ο
Bases:
objectGraphical interface to compute how many pixels represents a metric millimeter.
- Parameters
video_path (Union[str, os.PathLike]) β Path to a video file on disk.
known_metric_mm (float) β Known millimeter distance to get the pixels conversion factor for.
- Returns
The number of pixels per metric millimeter.
- Return type
- Example
>>> runner = GetPixelsPerMillimeterInterface(video_path='/Users/simon/Desktop/envs/simba/troubleshooting/two_black_animals_14bp/project_folder/videos/Together_1.avi', known_metric_mm=140) >>> runner.run() >>> runner = GetPixelsPerMillimeterInterface(video_path='/Users/simon/Desktop/blank_video.mp4', known_metric_mm=140) >>> runner.run()
SimBA pop-up UIsο
SimBA pop-up mixinο
- class simba.mixins.pop_up_mixin.PopUpMixin(title, config_path=None, main_scrollbar=True, size=(960, 720), icon=None)[source]ο
Bases:
objectMethods for pop-up windows in SimBA. E.g., common methods for creating pop-up windows with drop-downs, checkboxes, entry-boxes, listboxes etc.
- Parameters
title (str) β Pop-up window title
config_path (Optional[configparser.Configparser]) β path to SimBA project_config.ini. If path, the project config is read in. If None, the project config is not read in.
size (tuple) β HxW of the pop-up window. The size of the pop-up window in pixels.
main_scrollbar (bool) β If True, the pop-up window is scrollable.
- add_to_listbox_from_entrybox(list_box, entry_box)[source]ο
Add a value that populates a tkinter entry_box to a tkinter listbox.
- Parameters
list_box (Listbox) β The tkinter Listbox to add the value to.
entry_box (Entry_Box) β The tkinter Entry_Box containing the value that should be added to the list_box.
- add_value_to_listbox(list_box, value)[source]ο
Add a float value to a tkinter listbox.
- Parameters
list_box (Listbox) β The tkinter Listbox to add the value to.
value (float) β Value to add to the listbox.
- add_values_to_several_listboxes(list_boxes, values)[source]ο
Add N values to N listboxes. E.g., values[0] will be added to list_boxes[0].
- Parameters
list_boxes (List[Listbox]) β List of Listboxes that the values should be added to.
values (List[float]) β List of floats that will be added to the list_boxes.
- children_cnt_main()[source]ο
Find the number of children (e.g., labelframes) currently exist within a main pop-up window. Useful for finding the row at which a new frame within the window should be inserted.
- create_cb_frame(cb_titles, main_frm=None, frm_title='', idx_row=- 1, command=None)[source]ο
Creates a labelframe with checkboxes and inserts the labelframe into a window.
Note
One checkbox will be created per
cb_titles. The checkboxes will be labeled according to thecb_titles. If checking/un-checking the box should have some effect, pass that function ascommandwhich takes the name of the checked/unchecked box.- Parameters
main_frm (Optional[Union[Frame, Canvas, LabelFrame, ttk.Frame]]) β The pop-up window to insert the labelframe into.
cb_titles (List[str]) β List of strings representing the names of the checkboxes.
frm_title (Optional[str]) β Title of the frame.
idx_row (Optional[int]) β The location in main_frm to create the LabelFrame. If -1, then at the bottom.
command (Optional[Callable[[str], Any]]) β Optional function callable associated with checking/unchecking the checkboxes.
- Return Dict[str, BooleanVar]
Dictionary holding the
cb_titlesas keys and the BooleanVar representing if the checkbox is ticked or not.- Example
>>> PopUpMixin.create_cb_frame(cb_titles=['Attack', 'Sniffing', 'Rearing'], frm_title='My classifiers')
- create_choose_number_of_body_parts_frm(project_body_parts, run_function, title='SELECT NUMBER OF BODY-PARTS', dropdown_lbl='# of body-parts')[source]ο
Many menus depend on how many animals the user choose to compute metrics for. Thus, we need to populate the menus dynamically. This function creates a single drop-down menu where the user select the number of animals the user choose to compute metrics for. It inserts this drop-down iat the bottom of the pop-up window, and ties this dropdown menu choice to a callback.
- create_clf_checkboxes(main_frm, clfs, title='SELECT CLASSIFIER ANNOTATIONS')[source]ο
Creates a labelframe with one checkbox per classifier, and inserts the labelframe into the bottom of the pop-up window.
Note
Legacy. Use
create_cb_frameinstead.
- create_dropdown_frame(drop_down_titles, drop_down_options, frm_title='', idx_row=- 1, main_frm=None)[source]ο
Creates a labelframe with dropdowns.
- Parameters
main_frm (Optional[Union[Frame, Canvas, LabelFrame, ttk.Frame]]) β The pop-up window to insert the labelframe into. If None, one will be created.
drop_down_titles (List[str]) β The titles of the dropdown menus.
drop_down_options (List[str]) β The options in each dropdown. Note: All dropdowns must have the same options.
frm_title (Optional[str]) β Title of the frame.
- Return Dict[str, BooleanVar]
Dictionary holding the
drop_down_titlesas keys and the drop-down menus as values.- Example
>>> PopUpMixin.create_dropdown_frame(drop_down_titles=['Dropdown 1', 'Dropdown 2', 'Dropdown 2'], drop_down_options=['Option 1', 'Option 2'], frm_title='My dropdown frame')
- create_run_frm(run_function, title='RUN', btn_txt_clr='black', idx=None, btn_icon_name='rocket', padx=0, pady=0)[source]ο
Create a label frame with a single button with a specified callback.
- Parameters
btn_txt_clr β The color of the text on the execute button.
idx β If not none, then the index of the main frame where to insert the RUN labelframe.
btn_icon_name β Name of the icon to use for the run button. If None, then no icon.
run_function (object) β The function/method callback of the button.
title (str) β The title of the frame.
- enable_dropdown_from_checkbox(check_box_var, dropdown_menus)[source]ο
Given a single checkbox, enable a bunch of dropdowns if the checkbox is ticked, and disable the dropdowns if the checkbox is un-ticked.
- Parameters
check_box_var (BooleanVar) β The checkbox associated tkinter BooleanVar.
dropdown_menus (List[DropDownMenu]) β List of dropdowns which status is controlled by the
check_box_var.
- enable_entrybox_from_checkbox(check_box_var, entry_boxes, reverse=False)[source]ο
Given a single checkbox, enable or disable a bunch of entry-boxes based on the status of the checkbox.
- Parameters
check_box_var (BooleanVar) β The checkbox associated tkinter BooleanVar.
entry_boxes (List[Entry_Box]) β List of entry-boxes which status is controlled by the
check_box_var.reverse (bool) β If False, the entry-boxes are enabled with the checkbox is ticked. Else, the entry-boxes are enabled if checkbox is unticked. Default: False.
- frame_children(frame)[source]ο
Find the number of children (e.g., labelframes) currently exist within specified frame.Similar to
children_cnt_main, but accepts a specific frame rather than the main frame beeing hardcoded.
- place_frm_at_top_right(frm)[source]ο
Place a TopLevel tkinter pop-up at the top right of the monitor. Note: call before putting scrollbars or converting to Canvas.
- static place_window_at_corner(window, corner, offset_x=0, offset_y=0)[source]ο
Place the window at a screen corner. Placement is deferred (via after(0, β¦)) so the window is laid out first; call right after building the window.
- Parameters
win β A tk.Toplevel or tk.Tk window.
corner β One of βtop_leftβ, βtop_rightβ, βbottom_leftβ, βbottom_rightβ.
offset_x β Pixels from the corner horizontally (positive = inward).
offset_y β Pixels from the corner vertically (positive = inward).

