Listing 13 - Page 0: No Title

##############################################################################
# Python From Scratch
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2024
# Site: https://pythonfromscratch.com
#
# File: listing\chapter 13\13.1591 - No Title.py
# Description: No Title
##############################################################################

def get_selected(self):
    if item_selected := self.table.selection():
        selected_id = item_selected[0]
        return selected_id
    return None

def open_window(self, event):
    if selected_id := self.get_selected():
        site = self.manager.sites[selected_id]
    else:
        site = None
    self.show_site(site)

def show_site(self, site):
    self.window = Window(self, site, on_change=self.update)
    self.window.grab_set()
Click here to download the file