Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Python Programming for Arduino
  • Toc
  • feedback
Python Programming for Arduino

Python Programming for Arduino

By : Pratik Desai
4.6 (22)
close
Python Programming for Arduino

Python Programming for Arduino

4.6 (22)
By: Pratik Desai

Overview of this book

This is the book for you if you are a student, hobbyist, developer, or designer with little or no programming and hardware prototyping experience, and you want to develop IoT applications. If you are a software developer or a hardware designer and want to create connected devices applications, then this book will help you get started.
Table of Contents (13 chapters)
close
12
Index

Your first Python GUI program

As we discussed in an earlier chapter, the first program while learning any programming language includes printing Hello World!. Now, as we are starting Python programming for GUI, let's start by printing the same string in a GUI window instead of a prompt.

Just to start with GUI programming, we are going to execute a Python program and then jump into explaining the structure and the details of the code. Let's create a Python executable file using the following lines of code, name it helloGUI.py, and then run it. The execution process should complete without any dependency errors:

import Tkinter

# Initialize main windows with title and size
top = Tkinter.Tk()
top.title("Hello GUI")
top.minsize(200,30)

# Label widget
helloLabel = Tkinter.Label(top, text = "Hello World!")
helloLabel.pack()

# Start and open the window
top.mainloop()

You should be prompted with the following window on the successful execution of the preceding code...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete