Graphical User Interfaces PDF

Title Graphical User Interfaces
Course Paradigms of Programming
Institution University of Greenwich
Pages 3
File Size 123.1 KB
File Type PDF
Total Downloads 35
Total Views 141

Summary

Download Graphical User Interfaces PDF


Description

Graphical User Interfaces

1. Graphical User Interfaces (GUI) 2. Python Interfaces to create GUIs 3. Web Interfaces

 A graphical user interface (GUI) is an interface through which people can interact with electronic computing devices (e.g. Laptops, mobiles, game consoles).  GUIs use icons, menus and other visual representations to display information and related user controls. This is unlike text-based interfaces, where data and commands are in text. GUI representations are manipulated by a pointing device such as a mouse, trackball, stylus, or a finger on a touch screen.

 Human Computer Interaction (HCI) is a sub-discipline of Computer Science and User Interface Design is part of that discipline  The design of effective GUIs is informed and underpinned by theory from various disciplines (Psychology, Ergonomics, Behavioural Sciences, Design …) and there are specialist modules in Year 2 and 3 on UI design

    

Tkinter (part of the core distribution) PyQT and PySide (both use QT) WxPython (desktop multi-platform) Pyforms Kivy (games and mobile development) –only option for mobile development in Python, games and touch interfaces

 Python is a widely used option for creating small but also very substantial web applications  Typically web frameworks are used when developing web apps to enable reuse of code and of successful design patterns  A web framework is a collection of packages or modules which allow developers to write a web applications or services without having to handle such low-level details as protocols, sockets or process/thread management

 Python Web application frameworks used widely in industry include Django, Flask, Pyramid  Some examples of web applications developed using Django include YouTube, Spotify, Instagram, DropBox, Pinterest…  The actual user interface in web frameworks is not written in Python code. Templating languages are used that include Python code to generate HTML/CSS pages for building a graphical user interface (GUI) in many: programming languages. Tk provides a number of widgets commonly needed to develop desktop applications, such as button, menu, canvas, text, frame, label, etc. Tk has been ported to run on most flavors of Linux, Mac OS, Unix, and Microsoft Windows.”  Tkinter is the only GUI interface (an interface to Tk) that is included as standard package in the Python core distribution  Tkinter is cross-platform and applications run on Windows, Unix and MacOS  IDLE the is an integrated Python development environment that come standard with a Python installation. IDLE is an example of an application implemented using Tkinter  Tkinter is object-oriented The steps to create a simple “Hello World” window    

Import tkinter Initialise the window manager and create a window variable Rename the title of the window Run the method mainloop of the window object which will display the window until it is being manually closed

 So far we looked at isolated small code examples of how to use different elements from Tkinter  For a more substantial application it would make sense to use classes to structure your code using an OOP paradigm  The following example shows how to use a class in combination with Tkinter  In the example a window object is created as root for the MyGUI class and then passed to the class constructor  In a next step lets extend the class-based GUI example to create a menu bar (with File and Edit) to our user interface  In order to implement this we use Tkinter’s Menu class  In the example a separate instance method is used to create and assemble the menu. The method is called during initialisation  The code creates first a root menu (menu_bar) and then adds a file and edit menu. Menu itemsare bound to instance methods that are not implemented in detail but have been added for demo purposes...


Similar Free PDFs