MyWindow.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. #
  4. # MyWindow.py
  5. #
  6. # MIT License
  7. # Copyright 2022 Stephen Stengel <stephen.stengel@cwu.edu>
  8. #
  9. #The class for creating the window.
  10. import gi
  11. gi.require_version("Gtk", "3.0")
  12. from gi.repository import Gtk
  13. from Handlers import Handlers
  14. class MyWindow(Gtk.Window):
  15. def __init__(self):
  16. super().__init__(title = "RAVE TIME!")
  17. builder = Gtk.Builder()
  18. builder.add_from_file("glade-button.glade")
  19. jigglypuff = builder.get_object("Jigglypuff")
  20. start_button = builder.get_object("music_start")
  21. start_button.set_label("Play the music!")
  22. stop_button = builder.get_object("music_stop")
  23. stop_button.set_label("Stop the music!")
  24. stop_button.set_sensitive(False)
  25. rave_button = builder.get_object("rave_button")
  26. rave_button.set_label("Change color!")
  27. label1 = builder.get_object("label1")
  28. window = builder.get_object("myWindow")
  29. window.connect("destroy", Handlers.myDestroy)
  30. window.connect("destroy", Gtk.main_quit)
  31. myHandlers = Handlers(jigglypuff, stop_button, label1, window)
  32. builder.connect_signals(myHandlers)
  33. window.show_all()