Fedora Project / Red Hat

Slides:



Advertisements
Similar presentations
Win8 on Intel Programming Course Desktop : WPF Cédric Andreolli Intel Software
Advertisements

COMP 6703 Project A GUI Interface to the Gene Microarray Data Analysis Program SigMotif. Student: Ye Luo (u ) Clients: Professor Susan Wilson and.
Event Driven Programming and GUIs Part 3 CS221 – 4/15/09.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
ASP.NET Programming with C# and SQL Server First Edition
ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
Graphical User Interfaces A Quick Outlook. Interface Many methods to create and “interface” with the user 2 most common interface methods: – Console –
1 ADVANCED MICROSOFT WORD Lesson 15 – Creating Forms and Working with Web Documents Microsoft Office 2003: Advanced.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
1 Integrated Development Environment Building Your First Project (A Step-By-Step Approach)
A First Program Using C#
© 2011 Delmar, Cengage Learning Chapter 9 Collecting Data with Forms.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Microsoft Visual Basic 2005: Reloaded Second Edition
Tip Calculator App Building an Android App with Java © by Pearson Education, Inc. All Rights Reserved.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
Peter Andreae Python for Level 3 CS4HS see website: ecs.vuw.ac.nz/Main/PythonForSchools.
CMPD 434 MULTIMEDIA AUTHORING Chapter 06 Multimedia Authoring Process IV.
© 2010 Delmar, Cengage Learning Chapter 8 Collecting Data with Forms.
Python From the book “Think Python”
Object Oriented Software Development 9. Creating Graphical User Interfaces.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
FLUKA GUI Status FLUKA Meeting CERN, 10/7/2006.
WaveMaker Visual AJAX Studio 4.0 Training Basics: Building Your First Application Binding Basics.
University of Sunderland CIF 102/FIF102 Fundamentals of DatabasesUnit 15 Programming in Microsoft Access using VBA Using VBA to add functionality.
Building Extensible Desktop Applications with Zope 3 Nathan R. Yergler Software Engineer Creative Commons Licensed under Creative Commons Attribution 2.5.
Introduction to Processing. 2 What is processing? A simple programming environment that was created to make it easier to develop visually oriented applications.
How the Session Works Outline Practical on arrival Talk 1 Reflect on practical Clarify concepts Practical exercises at your own pace Talk 2: Further concepts.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
OCR GCSE Computing © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 1: Introduction.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 13 GUI Programming.
Overview GUI Programming with GTK+ and GLADE 장정철.
Intermediate 2 Computing Unit 2 - Software Development.
Innovation Intelligence ® 1 Chapter 4: Using TCL to Control the HyperMesh Session.
1 Lecture 5: Interactive Tools: Prototypers (HyperCard, Director, Visual Basic), Interface Builders Brad Myers Advanced User Interface Software.
Guide to Programming with Python
Chapter – 8 Software Tools.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
CSC 108H: Introduction to Computer Programming Summer 2011 Marek Janicki.
Building GUI applications with Python, GTK and Glade
Business rules.
Development Environment
Topics Graphical User Interfaces Using the tkinter Module
Introduction to Computer CC111
Chapter Topics 15.1 Graphical User Interfaces
Apply Procedures to Develop Message, Input, and Dialog Boxes
An Introduction to Computers and Visual Basic
1. Introduction to Visual Basic
The Linux Operating System
WORKSHOP 3 GSE IMPORT.
Fedora Remix Paul W. Frields Fedora Project Leader CA-LUG, 11 Feb 2009
Internationalizing your application with Quickly
The Visible Computer Chapter 3.
Fundamentals of Python: From First Programs Through Data Structures
Principles of report writing
Lecturer: Mukhtar Mohamed Ali “Hakaale”
12 Product Configurator
VISUAL BASIC.
Basic Usage of Glade Use Glade and create the interface
Welcome to E-Prime E-Prime refers to the Experimenter’s Prime (best) development studio for the creation of computerized behavioral research. E-Prime is.
CIS16 Application Development Programming with Visual Basic
GTK + Programming.
The Basic Usage and The Event Handling in Glade.
Computer Science 111 Fundamentals of Programming I User Interfaces
An Introduction to Computers and Visual Basic
Topics Graphical User Interfaces Using the tkinter Module
Chapter 15: GUI Applications & Event-Driven Programming
The University of Texas – Pan American
Presentation transcript:

Fedora Project / Red Hat PyGTK for Beginners Paul W. Frields Fedora Project / Red Hat Southeast LinuxFest June 13, 2010 Very excited to be here Thank the entire FOSSMeet team for their help in setting up this talk The Fedora Project is proud to help sponsor this conference, spreading FOSS A little about me: * Worked with Linux for >10 years * Joined Fedora Project in 2003 as a volunteer * Inaugural Board member in 2006 * February – Red Hat full time as FPL Copyright © 2010 Paul W. Frields, some rights reserved. Licensed under a Creative Commons Attribution-ShareAlike (CC BY-SA) 3.0 license.

What this talk covers Tools you can use to build and understand a graphical user interface (GUI) Understanding the GTK object and signal models How to hook Python code to a GUI Things to consider when designing your application (code and GUI)

What this talk does not cover How to be a good programmer The Python language Intro for programmers: Mark Pilgrim's Dive Into Python For absolute beginners: Wesley Chun's Core Python Programming User experience, human-computer interaction

What this talk presumes You know elementary programming concepts (variables, conditionals, loops, functions) You've written Python or another scripting language but you're not a programmer You are using a Linux system, not necessarily Fedora

Things you need Python GTK Text editor of choice

Things you'll want Glade3 Devhelp

Installing the tools Fedora, openSUSE: Use Add/Remove Software tool to add the GNOME Software Development collection Ubuntu: Use Synaptic Package Manager tool to add the python-gtk2-dev and glade packages

Workflow Glade to design UI (as GtkBuilder) Saved as XML Can be tweaked in Glade or any editor Python code loads the XML file as a resource Interactive elements assigned to objects Functions called based on interaction

GTK object model Based on classes and inheritance Each object can have its own special properties and methods Real-life example: “Chair” object, has a location property FoldingChair adds fold( ) function SwivelChair adds rotate( ) function

GTK object hierarchy example GtkButton: pushbutton widget, subclass of... GtkBin: widget that contains only one widget, subclass of... GtkContainer: widget that's a container for other widgets, subclass of... GtkWidget: object that is the base for all widgets, subclass of... GtkObject: base for all objects

How to learn more This is where devhelp comes in – provides hierarchical listing of inheritance For example, let's look at GtkButton in the listing Note that GtkButton inherits the properties and methods of the classes above (e.g. “visible” property from GtkWidget)

GTK signals This is the basis for interactivity and response Main loop and input interaction Interaction generates a signal, which can be caught and used to trigger a function Example: a button click, a checkbox filled or cleared

Important Python points import gtk lets you use GTK library bindings Create a GtkBuilder object Use gtk.Builder.add_from_file( ) to load objects def __init__(self): self.builder = gtk.Builder() self.builder.add_from_file('prog.builder') # Now you can refer to elements using # the self.builder object

Element references The gtk.Builder.get_object( ) function returns an object based on its name self.close_button = \ self.builder.get_object('close')

Simple example easy-entry.py – Takes text entry from a dialog and outputs the text on the command line Demonstrates very simple interface and signals Window, buttons, text entry Window deletion, “clicked” signal GTK main loop

Two approaches Write code, add GUI Design GUI, write code to fit

Code first? For GUI wrappers around an existing program Not all options are worth GUI-izing! GConf keys (soon GSettings) can store some tweakable configuration

Design first? Know your user and use cases Who is this tool for? How will they use it? How will it integrate with other apps? Draw a mockup first (paper is fine)

Using Glade for mockups Use boxes liberally GNOME Human Interface Guidelines provide layout help for a matching interface (Section 8, “Visual Design”) Many standard dialogs are easy to create

Intermediate topics

Distributing your work Write a setup.py file The setup( ) function takes parameters such as simple sequences that let distutils do the work MANIFEST.in file to include source content Simple commands for builds, tarballs... python setup.py --help-commands

Reminder: Program flow XML file defines the GUI elements Python code loads file into gtk.Builder object Python code continues to refine GUI and assign interactivity through additional functions

PyGTK can change the UI Not everything has to be written in the Glade file! Assign label text and other content Hide or show elements Example: PulseCaster

I18n and L10n I18n (internationalization) is the process of making code multilingual L10n (localization) is the process of translating content Don't restrict your audience to just English speakers

Adding i18n Transfer labels to your Python code Add gettext function import gettext _ = lambda x: gettext.ldgettext('myprog', x) Mark all strings with the _( ) function But now what? How to get them into translatable formats?

Babel to the rescue! Install the python-babel package Wraps around Python distutils to provide message (text string) extraction, for instance based on the _( ) function: python setup.py extract_messages

Thank you! Questions? pfrields@fedoraproject.org http://pfrields.fedorapeople.org