Category: New Python tutorial

python tutorials and learn python

Created with Sketch.

3 Ways to Set Options for a Tk Themed Widget

3 Ways to Set Options for a Tk Themed Widget Summary: in this tutorial, you’ll learn how to set options for a Tk themed widget using keyword arguments, a dictionary index, and config() method. When working with themed widgets, you often need to set their attributes e.g., text and image. Tkinter allows you to set…
Read more

Ttk Widgets

Ttk Widgets Summary: in this tutorial, you’ll learn about Tk themed widgets by using the Tkinter.ttk module. Introduction to Tk themed widgets Tkinter has two generations of widgets: The old classic tk widgets. Tkinter introduced them in 1991. The newer themed ttk widgets added in 2007 with Tk 8.5. The newer Tk themed widgets replace…
Read more

Tkinter Window

Tkinter Window Summary: in this tutorial, you’ll learn how to manipulate various attributes of a Tkinter window. Let’s start with a simple program that consists of a window: import tkinter as tk root = tk.Tk() root.mainloop() Code language: Python (python) Output: The root window has a title that defaults to tk. It also has three…
Read more

Tkinter Hello, World!

Tkinter Hello, World! Summary: in this tutorial, you’ll learn step by step how to develop the Tkinter “Hello, World!” program. Creating a window The following program shows how to display a window on the screen: import tkinter as tk root = tk.Tk() root.mainloop() Code language: Python (python) If you execute the program, you’ll see the…
Read more

Install Python

Install Python   Summary: in this tutorial, you’ll learn how to install Python on your computer including Windows, macOS, and Linux. Install Python on Windows First, download the latest version of Python from the download page. Second, double-click the installer file to launch the setup wizard. In the setup window, you need to check the…
Read more

Tkinter

Tkinter This Tkinter tutorial introduces you to the exciting world of GUI programming in Python. Tkinter is pronounced as tea-kay-inter. Tkinter is the Python interface to Tk, which is the GUI toolkit for Tcl/Tk. Tcl (pronounced as tickle) is a scripting language often used in testing, prototyping, and GUI development. Tk is an open-source, cross-platform…
Read more

Python Regex Cheat Sheet

Python Regex Cheat Sheet This page provides a Python regex cheat sheet that you can quickly reference while working with regular expressions. Character sets Pattern Meaning \w Match a single word character a-z, A-Z, 0-9, and underscore (_) \d Match a single digit 0-9 \s Match whitespace including \t, \n, and \r and space character…
Read more

Python Regex Flags

Python Regex Flags Summary: in this tutorial, you’ll learn about the Python regex flags and how they change the behavior of the regex engine for pattern matching. Introduction to the Python regex flags The regular expression functions like findall, finditer, search, match, split, sub, … have the parameter (flags) that accepts one or more regex…
Read more

Python Regex split()

Python Regex split() Summary: in this tutorial, you’ll learn how to use the Python regex split() function to split a string at the occurrences of matches of a regular expression. Introduction to the Python regex split() function The built-in re module provides you with the split() function that splits a string by the matches of…
Read more

Python Regex sub()

Python Regex sub() Summary: in this tutorial, you’ll learn about the Python regex sub() function that returns a string after replacing the matched pattern in a string with a replacement. Introduction to the Python regex sub-function The sub() is a function in the built-in re module that handles regular expressions. The sub() function has the…
Read more