Tkinter Tkinter is a GUI (graphical user interface) widget set for Python. The Tkinter module (“ToolKit interface”) is the standard Python interface to.

Slides:



Advertisements
Similar presentations
Computer Science 112 Fundamentals of Programming II User Interfaces
Advertisements

Windows Test Review.
Noadswood Science,  To know how to use Python to produce windows and colours along with specified co-ordinates Sunday, April 12, 2015.
Why ROOT?. ROOT ROOT: is an object_oriented frame work aimed at solving the data analysis challenges of high energy physics Object _oriented: by encapsulation,
Graphical User Interface (GUI) A GUI allows user to interact with a program visually. GUIs are built from GUI components. A GUI component is an object.
Using Powerpoint to Create Interface Prototype Copy & Paste Interface Designs –Use Screen Capture to Copy Existing Interface –“Print Screen / SysRq” Button:
GUIs and Color Here's a first crack at an 8-puzzle widget:
I210 review (for final exam) Fall 2011, IUB. What’s in the Final Exam Multiple Choice (5) Short Answer (5) Program Completion (3) Note: A single-sided.
Computer Science 111 Fundamentals of Programming I User Interfaces Introduction to GUI programming.
COMPSCI 101 Principles of Programming
Guide to Programming with Python Chapter Ten GUI Development: The Mad Lib Program.
Visual Basic .NET BASICS
PYTHON GUI PROGRAMMING
In this activity, we are going to resize and move a window around the desktop with a mouse. 1Double-click the icon ‘My Computer’ to display its content.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 20 Graphical User Interface (GUI)
User Interface Programming in C#: Direct Manipulation Chris North CS 3724: HCI.
Introduction to Windows Created by Mrs. Leverette.
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.
What is Visual Basic.NET? 110 B-1 e.g. a word processor doesn’t do anything until the user clicks on a button, types text... A programming language that.
Graphical User Interface You will be used to using programs that have a graphical user interface (GUI). So far you have been writing programs that have.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 13 GUI Programming.
Tkinter Basics. Initial Stuff To get the package: from tkinter import * To make a window, give it a title and operate it: windowVar = Tk() windowVar.title(“your.
Graphics Programming with Python. Many choices Python offers us several library choices:  Tkinter  WxPython  PyQt  PyGTK  Jython  And others...
Creating visual interfaces in python
Ajmer Singh PGT(IP) JAVA IDE Programming - I. Ajmer Singh PGT(IP) GUI (Graphical User Interface) It is an interface that uses a graphic entities along.
Guide to Programming with Python
COMPSA Exam Prep Session by Paul Allison On: April 8th from 1:30-3:00 Location TBA Winter 2016CISC101 - Prof. McLeod1.
Intro to Pygame Lecture 05. What is Pygame? It is a set of Python modules designed for writing games. It makes writing games possible for beginners. import.
ENGINEERING 1D04 Tutorial 4. What are we doing today? Focus Functions Scope of Variables Returning Values Objects Graphics library Aliasing Events Mouse.
Visual Basic .NET BASICS
Microsoft Visual Basic 2005: Reloaded Second Edition
Introduction to HTML.
MOM! Phineas and Ferb are … Aims:
Topics Graphical User Interfaces Using the tkinter Module
Event Loops and GUI Intro2CS – weeks
PYGAME.
Graphical User Interfaces (GUIs)
Milestone 2 Overview.
Java Swing.
Graphical User Interfaces (GUIs)
European Computer Driving Licence
Creating a Graph in Excel Review
GUI Using Python.
Fundamentals of Python: From First Programs Through Data Structures
This Week: Tkinter for GUI Interfaces Some examples
Tkinter GUIs Computer Science and Software Engineering
Predefined Dialog Boxes
Presentation Title Subtitle or Date.
AWT Components and Containers
Tkinter Widgets CS 260 Dick Steflik.
Windows xp PART 1 DR.WAFAA SHRIEF.
Resizing and adding borders in PSE
Google Calendar Appointments
Fundamentals of Programming I Windows, Labels, and Command Buttons
Topics Graphical User Interfaces Using the tkinter Module
Enable an activity in The Control Tower
Graphics and FLTK CSCE 121 J. Michael Moore
Creating Frames on a Web Page
Layout management in Tkinter
Python – Tkinter Windows Application
Tkinter Button import tkinter as tk root = tk.Tk()
Tkinter Label תווית The Label widget is a standard Tkinter widget used to display a text or image on the screen. import tkinter as tk root = tk.Tk() lb.
Tkinter Event. אירוע. Events and Bindings widget.bind(event, handler)
The University of Texas – Pan American
Mark Thompson Doug Stainbrook Solid Edge Technical Marketing
Graphical User Interface
Human-computer interaction
Tkinter User Input Form
Tkinter Canvas   Canvas widget to display graphical elements like lines or text.   Peymer Anatoly.
TA: Nouf Al-Harbi NoufNaief.net :::
Presentation transcript:

Tkinter Tkinter is a GUI (graphical user interface) widget set for Python. The Tkinter module (“ToolKit interface”) is the standard Python interface to the Tk GUI toolkit. import tkinter as tk #To initialize Tkinter, we have to create a Tk root widget. root = tk.Tk() #The program will stay in the event loop until we close the window. tk.mainloop() Peymer Anatoly

Tkinter geometry() The geometry() method sets a size for the window and positions it on the screen import tkinter as tk root = tk.Tk() root.geometry("300x150+30+30") # Size: 300x150, Loc: 30,30 tk.mainloop() 30x30 300 150 Peymer Anatoly

Tkinter Full screen import tkinter as tk root = tk.Tk() x = root.winfo_screenwidth() y = root.winfo_screenheight() root.geometry("%dx%d" % (x,y)) tk.mainloop() Peymer Anatoly

No title bar and window buttons, plus no borders Tkinter No title bar and window buttons, plus no borders import tkinter as tk root = tk.Tk() root.overrideredirect(1) tk.mainloop() Peymer Anatoly

Tkinter Title import tkinter as tk root = tk.Tk() root.title("The first sample") tk.mainloop() Peymer Anatoly

Tkinter Resizable() import tkinter as tk root = tk.Tk() root.resizable(width=tk.FALSE, height=tk.FALSE) tk.mainloop() Peymer Anatoly

Tkinter background import tkinter as tk root = tk.Tk() tk_rgb = "#%02x%02x%02x" % (128, 192, 200) root["background"]=tk_rgb tk.mainloop() Peymer Anatoly

Tkinter Peymer Anatoly

Tkinter Peymer Anatoly

Tkinter Peymer Anatoly

Tkinter Peymer Anatoly

Tkinter Peymer Anatoly

Tkinter Peymer Anatoly from tkinter import * MAX_ROWS = 36 FONT_SIZE = 10 # (pixels) COLORS = ['snow', 'ghost white', 'white smoke', 'gainsboro', 'floral white', 'old lace', 'linen', 'antique white', 'papaya whip', 'blanched almond', 'bisque', 'peach puff', . . . root = Tk() root.title("Named colour chart") row = 0 col = 0 for color in COLORS: e = Label(root, text=color, background=color, font=(None, -FONT_SIZE)) e.grid(row=row, column=col, sticky=E+W) row += 1 if (row > 36): col += 1 root.mainloop() Peymer Anatoly

Tkinter Windows Attributes Most options take a true/false value -alpha double how opaque the overall window is; note that changing between 1.0 and any other value may cause the window to flash. -fullscreen boolean controls whether the window fills the whole screen, including taskbar -disabled boolean makes it impossible to interact with the window and redraws the focus -toolwindow boolean makes a window with a single close-button (which is smaller than usual) on the right of the title bar -topmost boolean makes sure the window always stays on top of all other windows Peymer Anatoly

Tkinter Transparency import tkinter as tk root = tk.Tk() # use transparency level 0.1 to 1.0 (no transparency) root.attributes("-alpha", 0.3) tk.mainloop() Peymer Anatoly

Tkinter Fullscreen import tkinter as tk root = tk.Tk() root.attributes("-fullscreen", True) tk.mainloop() Peymer Anatoly