Python tkinter Basic Exercise: Create a window and set the default window size using tkinter module
Python tkinter Basic: Exercise-4 with Solution
Write a Python GUI program to create a window and set the default window size using tkinter module.
Sample Solution:
Python Code:
import tkinter as tk
parent = tk.Tk()
parent.title("-Welcome to Python tkinter Basic exercises-")
parent.geometry('600x300')
parent.mainloop()
Sample Output:
Flowchart:
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python GUI program to create a label and change the label font style (font name, bold, size) using tkinter module.
Next: Write a Python GUI program to create a window and disable to resize the window using tkinter module.
What is the difficulty level of this exercise?
Test your Python skills with w3resource's quiz
Python: Tips of the Day
Returns a random element from a list
Example:
from random import randint def tips(lst): return lst[randint(0, len(lst) - 1)] print(tips([2, 5, 9, 11, 15]))
Output:
5
- 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