Python tkinter Basic Exercise: Create a window and set its title
Python tkinter Basic: Exercise-1 with Solution
Write a Python GUI program to import Tkinter package and create a window and set its title.
Sample Solution:
Python Code:
import tkinter as tk
# Create instance
parent = tk.Tk()
# Add a title
parent.title("-Welcome to Python tkinter Basic exercises-")
# Start GUI
parent.mainloop()
Sample Output:
Flowchart:
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Python tkinter Basic Exercise Home
Next: Write a Python GUI program to import tkinter package and create a window. Set its title and add a label to the window.
What is the difficulty level of this exercise?
Test your Python skills with w3resource's quiz
Python: Tips of the Day
Returns the least common multiple of a list of numbers.
Example:
from functools import reduce from math import gcd def tips_lcm(nums): return reduce((lambda x, y: int(x * y / gcd(x, y))), nums) print(tips_lcm([3, 12, 7, 4])) print(tips_lcm([1, 2, 3, 4, 5, 6]))
Output:
84 60
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- React - JavaScript Library
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework