Answers for "tkinter module in python"

5

tkinter tutorial

# check this code first.
from tkinter import *

app = Tk()
# The title of the project
app.title("The title of the project")
# The size of the window
app.geometry("400x400")

# Defining a funtion
def c():
    # Label
    m = Label(app, text="Text")
    m.pack()


# Button
l = Button(app, text="The text of the Butoon", command=c)
# Packing the Button
l.pack()
app.mainloop()
# Quick Note : 
# When you put a command you should not use parentheses
# l = Button(app, text="The text of the Butoon", command=c)
# l = Button(app, text="The text of the Butoon", command=c())
Posted by: Guest on November-22-2020
4

python gui

import tkinter as tk
#Importing the main module
window = tk.Tk()
window.mainloop()
Posted by: Guest on October-04-2020
13

tkinter python 3

import tkinter as tk

obj = tk.Tk() # Creates a tkinter object
label = tk.Label(obj, text="This is a text button")
Posted by: Guest on February-01-2020
-2

How to import tkinter in python

# only works in Python 2.x
import Tkinter

# only works in Python 3.x
import tkinter
Posted by: Guest on May-10-2021

Code answers related to "tkinter module in python"

Python Answers by Framework

Browse Popular Code Answers by Language