Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import xbmcgui
- from resources.scripts.GetAllSportsScript import get_sports
- def create_sport_buttons(window):
- # Get the sports data from the GetAllSportsScript.py
- sports_data = get_sports()
- # Loop through the sports data and create buttons dynamically
- for index, sport in enumerate(sports_data):
- button_id = 'SportButton{}'.format(index + 1)
- button_label = sport['name']
- # Create the button control
- button = xbmcgui.ControlButton(id=button_id, label=button_label)
- # Add the button to the window
- window.addControl(button)
- def show_all_sports():
- # Create the window
- window = xbmcgui.Window(13001)
- # Create sport buttons in the window
- create_sport_buttons(window)
- # Show the window
- window.doModal()
- # Close the window once it's no longer needed
- del window
- # Entry point of the script
- if __name__ == '__main__':
- # Call the function to show all sports
- show_all_sports()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement