├── Section 3 ├── __init__.py ├── Designer_code │ ├── __init__.py │ ├── Video2_First_Design.ui │ ├── Video2_First_Design.py │ ├── Video3_First_Design.ui │ ├── Video4_First_Design.ui │ ├── backup_Video4_First_Design.ui │ ├── Video3_First_Design.py │ ├── Video5_First_Design.ui │ └── Video4_First_Design.py ├── icons │ ├── Thumbs.db │ ├── exit_icon.png │ └── new_icon.png ├── Video4_1_Design_modular.py ├── Video1_1_First_GUI_PyQt5.py ├── Video1_2_First_GUI_PyQt5_title.py ├── Video1_3_First_GUI_PyQt5_size.py ├── Video4_2_Design_class.py ├── Video1_5_Class_GUI_PyQt5.py ├── Video4_3_Design_class_button.py ├── Video1_6_Class_GUI_PyQt5_inherit.py ├── Video4_4_Design_class_tabs.py ├── Video4_3_Design_class_methods.py ├── Video1_4_First_GUI_PyQt5_Structure.py ├── Video5_1_Design_actions.py ├── Video1_7_Class_GUI_PyQt5_inherit_QMain.py ├── Video5_2_Design_actions.py ├── Video5_3_Design_actions_statusbar.py ├── Video1_8_Class_GUI_PyQt5_widget.py ├── Video5_4_Design_actions_connect.py ├── Video5_5_Design_actions_connect_shortcut.py ├── Video1_9_Class_GUI_PyQt5_widget_QAction.py └── Video5_6_Design_actions_icons.py ├── Section 4 ├── __init__.py ├── Designer_code │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-37.pyc │ │ ├── Video4_Design.cpython-37.pyc │ │ ├── Video3_1_Design.cpython-37.pyc │ │ ├── Video7_1_Design.cpython-37.pyc │ │ ├── Video2_2_slots_Design.cpython-37.pyc │ │ ├── Video2_3_slots_Design.cpython-37.pyc │ │ ├── Video2_4_slots_Design.cpython-37.pyc │ │ ├── Video1_1_CSS_no_Design.cpython-37.pyc │ │ ├── Video7_7_SQL_colors_Design.cpython-37.pyc │ │ ├── Video1_5_CSS_entire_UI_Design.cpython-37.pyc │ │ ├── Video4_6_server_buttons_Design.cpython-37.pyc │ │ ├── Video6_6_server_buttons_Design.cpython-37.pyc │ │ ├── Video7_11_SQL_final_style_Design.cpython-37.pyc │ │ └── Video3_7_converter_radio_text_Design.cpython-37.pyc │ ├── Video1_1_CSS_no_Design.ui │ ├── Video1_2_CSS_tab_Design.ui │ ├── Video1_3_CSS_widget_class_Design.ui │ ├── Video1_4_CSS_one_widget_Design.ui │ └── Video1_5_CSS_entire_UI_Design.ui ├── icons │ ├── py.ico │ ├── exit_icon.png │ └── new_icon.png ├── PUBLISHERS.db ├── __pycache__ │ ├── Video5_1.cpython-37.pyc │ ├── __init__.cpython-37.pyc │ ├── Video1_1_CSS.cpython-37.pyc │ ├── Video4_CATCH_EXCEPTIONS_PRINT.cpython-37.pyc │ └── Video6_Networking_TCPServer_TCPClient.cpython-37.pyc ├── Video4_CATCH_EXCEPTIONS.py ├── Video4_CATCH_EXCEPTIONS_PRINT.py ├── Video5_1.spec ├── Video1_1_CSS.spec ├── Video1_1_CSS.py ├── Video1_5_CSS.py ├── Video2_2_slots.py ├── Video2_3_slots.py ├── Video3_1.py ├── Video2_4_slots.py ├── Video3_2_converter.py ├── Video3_3_converter.py ├── Video3_4_converter_dialogs_BUG.py ├── Video6_Networking_TCPServer_TCPClient.py ├── Video3_5_converter_FIXED_disconnect.py ├── Video3_6_converter_FIXED_disconnect_default.py ├── Video4_1.py ├── Video5_1.py ├── Video3_7_converter_FIXED_disconnect_pass.py ├── Video4_2_uncaught.py ├── Video4_3_uncaught_no_click.py ├── Video4_4_excepthook.py └── Video4_5_excepthook_print.py ├── Section1 ├── __init__.py ├── py.ico ├── Video1_1_First_GUI_tkinter.py ├── Video1_2_First_GUI_tkinter_size.py ├── Video1_3_First_GUI_tkinter_title.py ├── Video1_4_First_GUI_tkinter_icon.py ├── Video2_2_GUI_tkinter_button_left.py ├── Video2_1_GUI_tkinter_add_button.py ├── Video2_3_GUI_tkinter_window_position.py ├── Video2_4_GUI_tkinter_click_event.py ├── Video2_5_GUI_tkinter_another_button.py ├── Video2_6_GUI_tkinter_more_buttons.py ├── Video2_7_GUI_tkinter_buttons_print.py ├── Video3_1_GUI_tkinter_grid_layout.py ├── Video3_3_GUI_tkinter_grid_row_below.py ├── Video3_2_GUI_tkinter_grid_row.py ├── Video3_4_GUI_tkinter_grid_sticky.py ├── Video4_2_GUI_tkinter_label.py ├── Video4_1_GUI_tkinter_entry.py ├── Video3_5_GUI_tkinter_grid_property.py ├── Video4_3_GUI_tkinter_msg.py ├── Video4_4_GUI_tkinter_msg_clear.py ├── Video5_1_GUI_tkinter_menu.py ├── Video5_2_GUI_tkinter_menu_exit.py ├── Video5_3_GUI_tkinter_exit.py └── Video5_4_GUI_tkinter_padding.py ├── Section2 ├── __init__.py ├── py.ico ├── LightsInTheCity.gif ├── __pycache__ │ ├── __init__.cpython-37.pyc │ ├── Video5_1_GUI_Advanced_oop.cpython-37.pyc │ └── Video6_2_GUI_Advanced_UnitTest_class.cpython-37.pyc ├── Video6_1_GUI_Advanced_UnitTest.py ├── Video6_2_GUI_Advanced_UnitTest_class.py ├── Video1_1_GUI_Advanced_tab_control.py ├── Video1_2_GUI_Advanced_tab_two.py ├── Video1_3_GUI_Advanced_tab_scroll.py ├── Video1_4_GUI_Advanced_tab_url.py ├── Video2_1_GUI_Advanced_data.py └── Video3_1_GUI_Advanced_image.py ├── LICENSE └── README.md /Section 3/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Section 4/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Section1/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Section2/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Section 3/Designer_code/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Section 4/Designer_code/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Section1/py.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section1/py.ico -------------------------------------------------------------------------------- /Section2/py.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section2/py.ico -------------------------------------------------------------------------------- /Section 4/icons/py.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/icons/py.ico -------------------------------------------------------------------------------- /Section 3/icons/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 3/icons/Thumbs.db -------------------------------------------------------------------------------- /Section 4/PUBLISHERS.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/PUBLISHERS.db -------------------------------------------------------------------------------- /Section 3/icons/exit_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 3/icons/exit_icon.png -------------------------------------------------------------------------------- /Section 3/icons/new_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 3/icons/new_icon.png -------------------------------------------------------------------------------- /Section 4/icons/exit_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/icons/exit_icon.png -------------------------------------------------------------------------------- /Section 4/icons/new_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/icons/new_icon.png -------------------------------------------------------------------------------- /Section2/LightsInTheCity.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section2/LightsInTheCity.gif -------------------------------------------------------------------------------- /Section 4/__pycache__/Video5_1.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/__pycache__/Video5_1.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /Section2/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section2/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/__pycache__/Video1_1_CSS.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/__pycache__/Video1_1_CSS.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/Designer_code/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/Designer_code/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /Section2/__pycache__/Video5_1_GUI_Advanced_oop.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section2/__pycache__/Video5_1_GUI_Advanced_oop.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/Designer_code/__pycache__/Video4_Design.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/Designer_code/__pycache__/Video4_Design.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/Designer_code/__pycache__/Video3_1_Design.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/Designer_code/__pycache__/Video3_1_Design.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/Designer_code/__pycache__/Video7_1_Design.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/Designer_code/__pycache__/Video7_1_Design.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/__pycache__/Video4_CATCH_EXCEPTIONS_PRINT.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/__pycache__/Video4_CATCH_EXCEPTIONS_PRINT.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/Designer_code/__pycache__/Video2_2_slots_Design.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/Designer_code/__pycache__/Video2_2_slots_Design.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/Designer_code/__pycache__/Video2_3_slots_Design.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/Designer_code/__pycache__/Video2_3_slots_Design.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/Designer_code/__pycache__/Video2_4_slots_Design.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/Designer_code/__pycache__/Video2_4_slots_Design.cpython-37.pyc -------------------------------------------------------------------------------- /Section2/__pycache__/Video6_2_GUI_Advanced_UnitTest_class.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section2/__pycache__/Video6_2_GUI_Advanced_UnitTest_class.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/Designer_code/__pycache__/Video1_1_CSS_no_Design.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/Designer_code/__pycache__/Video1_1_CSS_no_Design.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/__pycache__/Video6_Networking_TCPServer_TCPClient.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/__pycache__/Video6_Networking_TCPServer_TCPClient.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/Designer_code/__pycache__/Video7_7_SQL_colors_Design.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/Designer_code/__pycache__/Video7_7_SQL_colors_Design.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/Designer_code/__pycache__/Video1_5_CSS_entire_UI_Design.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/Designer_code/__pycache__/Video1_5_CSS_entire_UI_Design.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/Designer_code/__pycache__/Video4_6_server_buttons_Design.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/Designer_code/__pycache__/Video4_6_server_buttons_Design.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/Designer_code/__pycache__/Video6_6_server_buttons_Design.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/Designer_code/__pycache__/Video6_6_server_buttons_Design.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/Designer_code/__pycache__/Video7_11_SQL_final_style_Design.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/Designer_code/__pycache__/Video7_11_SQL_final_style_Design.cpython-37.pyc -------------------------------------------------------------------------------- /Section 4/Designer_code/__pycache__/Video3_7_converter_radio_text_Design.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/-Hands-on-Python-3.x-GUI-Programming/HEAD/Section 4/Designer_code/__pycache__/Video3_7_converter_radio_text_Design.cpython-37.pyc -------------------------------------------------------------------------------- /Section1/Video1_1_First_GUI_tkinter.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Feb 24, 2019 3 | @author: Burkhard A. Meier 4 | ''' 5 | 6 | 7 | 8 | 9 | 10 | 11 | import tkinter as tk # alias as tk 12 | 13 | gui = tk.Tk() # create class instance 14 | gui.mainloop() # run main event loop 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Section1/Video1_2_First_GUI_tkinter_size.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Feb 24, 2019 3 | @author: Burkhard A. Meier 4 | ''' 5 | 6 | 7 | 8 | 9 | 10 | 11 | import tkinter as tk # alias as tk 12 | 13 | gui = tk.Tk() # create class instance 14 | gui.geometry('600x400') # specify a window width and height 15 | gui.mainloop() # run main event loop 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Section 3/Video4_1_Design_modular.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Mar 8, 2019 3 | @author: Burkhard A. Meier 4 | ''' 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | from PyQt5 import QtWidgets 13 | from Section3.Designer_code.Video3_First_Design import Ui_MainWindow 14 | 15 | 16 | 17 | if __name__ == "__main__": 18 | import sys 19 | app = QtWidgets.QApplication(sys.argv) 20 | MainWindow = QtWidgets.QMainWindow() 21 | ui = Ui_MainWindow() 22 | ui.setupUi(MainWindow) 23 | MainWindow.show() 24 | sys.exit(app.exec_()) 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Section1/Video1_3_First_GUI_tkinter_title.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Feb 24, 2019 3 | @author: Burkhard A. Meier 4 | ''' 5 | 6 | 7 | 8 | 9 | 10 | 11 | import tkinter as tk # alias as tk 12 | 13 | gui = tk.Tk() # create class instance 14 | gui.geometry('600x400') # specify a window width and height 15 | gui.title('GUI written in tkinter') # give the GUI a window title 16 | gui.mainloop() # run main event loop 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Section 3/Video1_1_First_GUI_PyQt5.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Mar 7, 2019 3 | @author: Burkhard A. Meier 4 | ''' 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | import sys 13 | from PyQt5.QtWidgets import QApplication, QWidget 14 | 15 | app = QApplication(sys.argv) # sys.argv accepts arguments when run from the command line 16 | gui = QWidget() # creates top-level window 17 | gui.show() # have to call show() to make it visible 18 | sys.exit(app.exec_()) # run the application; PyQt5 exec_ ends with an underscore 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Section1/Video1_4_First_GUI_tkinter_icon.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Feb 24, 2019 3 | @author: Burkhard A. Meier 4 | ''' 5 | 6 | 7 | 8 | 9 | 10 | 11 | import tkinter as tk # alias as tk 12 | 13 | gui = tk.Tk() # create class instance 14 | gui.geometry('600x400') # specify a window width and height 15 | gui.title('GUI written in tkinter') # give the GUI a window title 16 | gui.iconbitmap('py.ico') # icon expected inside the same folder 17 | gui.mainloop() # run main event loop 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Section 3/Video1_2_First_GUI_PyQt5_title.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Mar 7, 2019 3 | @author: Burkhard A. Meier 4 | ''' 5 | 6 | 7 | 8 | 9 | 10 | 11 | import sys 12 | from PyQt5.QtWidgets import QApplication, QWidget 13 | 14 | app = QApplication(sys.argv) # sys.argv accepts arguments when run from the command line 15 | gui = QWidget() # creates top-level window 16 | 17 | gui.setWindowTitle('PyQt5 GUI') # give our Window a title 18 | 19 | gui.show() # have to call show() to make it visible 20 | sys.exit(app.exec_()) # run the application; PyQt5 exec_ ends with an underscore 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Section 4/Video4_CATCH_EXCEPTIONS.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Mar 11, 2019 3 | A big Thanks to James Mukuya 4 | @author: Burkhard A. Meier 5 | ''' 6 | 7 | 8 | 9 | 10 | 11 | 12 | # Simply import this module into your Python/PyQt5 module to catch exceptions 13 | 14 | import sys 15 | from PyQt5 import QtWidgets 16 | 17 | 18 | def catch_exceptions(t, val, tb): 19 | '''Catch any exceptions and display in QMessage box 20 | t=exception type 21 | val=exception value 22 | tb=traceback 23 | ''' 24 | 25 | QtWidgets.QMessageBox.critical(None,'An Exception was Raised', 26 | 'Value: {}'.format(val)) 27 | 28 | sys.excepthook = catch_exceptions # this sets up the hook to catch any uncaught exceptions 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Section 3/Video1_3_First_GUI_PyQt5_size.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Mar 7, 2019 3 | @author: Burkhard A. Meier 4 | ''' 5 | 6 | 7 | 8 | 9 | 10 | 11 | import sys 12 | from PyQt5.QtWidgets import QApplication, QWidget 13 | 14 | app = QApplication(sys.argv) # sys.argv accepts arguments when run from the command line 15 | gui = QWidget() # creates top-level window 16 | 17 | gui.setWindowTitle('PyQt5 GUI') # give our Window a title 18 | gui.resize(400, 300) # specify Window size: width, height 19 | 20 | gui.show() # have to call show() to make it visible 21 | sys.exit(app.exec_()) # run the application; PyQt5 exec_ ends with an underscore 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Section 4/Video4_CATCH_EXCEPTIONS_PRINT.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Mar 11, 2019 3 | A big Thanks to James Mukuya 4 | @author: Burkhard A. Meier 5 | ''' 6 | 7 | 8 | 9 | 10 | 11 | 12 | # Simply import this module into your Python/PyQt5 module to catch exceptions 13 | 14 | import sys 15 | from PyQt5 import QtWidgets 16 | 17 | 18 | def catch_exceptions(t, val, tb): 19 | '''Catch any exceptions and display in QMessage box 20 | t=exception type 21 | val=exception value 22 | tb=traceback 23 | ''' 24 | 25 | QtWidgets.QMessageBox.critical(None,'An Exception was Raised', 26 | 'Value: {}'.format(val)) 27 | old_hook(t, val, tb) 28 | 29 | old_hook = sys.excepthook 30 | 31 | sys.excepthook = catch_exceptions # this sets up the hook to catch any uncaught exceptions 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Section1/Video2_2_GUI_tkinter_button_left.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Feb 24, 2019 3 | @author: Burkhard A. Meier 4 | ''' 5 | 6 | 7 | 8 | 9 | 10 | 11 | import tkinter as tk # alias as tk 12 | from tkinter import ttk # themed tk 13 | 14 | gui = tk.Tk() # create class instance 15 | gui.geometry('400x200') # specify a window width and height 16 | gui.title('GUI written in tkinter') # give the GUI a window title 17 | gui.iconbitmap('py.ico') # icon expected inside the same folder 18 | 19 | button_one = ttk.Button(gui, text="Click Me") # create a button, parent=gui 20 | button_one.pack(side=tk.LEFT) # align button left 21 | 22 | gui.mainloop() # run main event loop 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Section1/Video2_1_GUI_tkinter_add_button.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Feb 24, 2019 3 | @author: Burkhard A. Meier 4 | ''' 5 | 6 | 7 | 8 | 9 | 10 | 11 | import tkinter as tk # alias as tk 12 | from tkinter import ttk # themed tk 13 | 14 | gui = tk.Tk() # create class instance 15 | gui.geometry('400x200') # specify a window width and height 16 | gui.title('GUI written in tkinter') # give the GUI a window title 17 | gui.iconbitmap('py.ico') # icon expected inside the same folder 18 | 19 | button_one = ttk.Button(gui, text="Click Me") # create a button, parent=gui 20 | button_one.pack() # use the pack layout manager 21 | 22 | gui.mainloop() # run main event loop 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Section 3/Video4_2_Design_class.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Mar 8, 2019 3 | @author: Burkhard A. Meier 4 | ''' 5 | 6 | 7 | 8 | 9 | 10 | import sys 11 | from PyQt5 import QtWidgets 12 | from Section3.Designer_code.Video3_First_Design import Ui_MainWindow 13 | 14 | 15 | class RunDesignerGUI(): 16 | 17 | def __init__(self): 18 | app = QtWidgets.QApplication(sys.argv) 19 | self.MainWindow = QtWidgets.QMainWindow() 20 | 21 | self.ui = Ui_MainWindow() 22 | self.ui.setupUi(self.MainWindow) 23 | 24 | self.MainWindow.setWindowTitle('PyQt5 GUI') # change window title 25 | 26 | self.MainWindow.show() 27 | sys.exit(app.exec_()) 28 | 29 | 30 | if __name__ == "__main__": 31 | RunDesignerGUI() 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Section1/Video2_3_GUI_tkinter_window_position.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Feb 24, 2019 3 | @author: Burkhard A. Meier 4 | ''' 5 | 6 | 7 | 8 | 9 | 10 | 11 | import tkinter as tk # alias as tk 12 | from tkinter import ttk # themed tk 13 | 14 | gui = tk.Tk() # create class instance 15 | gui.geometry('400x200+300+300') # specify window width, height and position 16 | 17 | gui.title('GUI written in tkinter') # give the GUI a window title 18 | gui.iconbitmap('py.ico') # icon expected inside the same folder 19 | 20 | button_one = ttk.Button(gui, text="Click Me") # create a button, parent=gui 21 | button_one.pack() # align button default 22 | 23 | gui.mainloop() # run main event loop 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Section2/Video6_1_GUI_Advanced_UnitTest.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Mar 5, 2019 3 | @author: Burkhard A. Meier 4 | ''' 5 | 6 | 7 | 8 | 9 | from Section2.Video5_1_GUI_Advanced_oop import GuiOOP 10 | 11 | # Create instance of Gui class 12 | gui_instance = GuiOOP() 13 | 14 | # Test 1: Verify default value is displayed 15 | print(gui_instance.update_label.cget('text')) # assert