Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to get input in tkinter

#Import the required Libraries
from tkinter import *
from tkinter import ttk

#Create an instance of Tkinter frame
win= Tk()

#Set the geometry of Tkinter frame
win.geometry("750x250")

def display_text():
   global entry
   string= entry.get()
   label.configure(text=string)

#Initialize a Label to display the User Input
label=Label(win, text="", font=("Courier 22 bold"))
label.pack()

#Create an Entry widget to accept User Input
entry= Entry(win, width= 40)
entry.focus_set()
entry.pack()

#Create a Button to validate Entry Widget
ttk.Button(win, text= "Okay",width= 20, command= display_text).pack(pady=20)

win.mainloop()
Comment

how to add input box in tkinter

from tkinter import *

window = Tk()
# entry box
my_input = Entry()
my_input.pack()

window.mainloop()
Comment

tkinter input box

import tkinter as tk

root= tk.Tk()

canvas1 = tk.Canvas(root, width = 400, height = 300)
canvas1.pack()

entry1 = tk.Entry (root) 
canvas1.create_window(200, 140, window=entry1)

def getSquareRoot ():  
    x1 = entry1.get()
    
    label1 = tk.Label(root, text= float(x1)**0.5)
    canvas1.create_window(200, 230, window=label1)
    
button1 = tk.Button(text='Get the Square Root', command=getSquareRoot)
canvas1.create_window(200, 180, window=button1)

root.mainloop()
Comment

PREVIOUS NEXT
Code Example
Python :: convert mb to gb python 
Python :: drop rows with null date in pandas 
Python :: update python mac 
Python :: django import csrf exemplt 
Python :: how to sort dictionary in python by value 
Python :: openpyxl xls 
Python :: set dtype for multiple columns pandas 
Python :: python program to count vowels in a string 
Python :: python count hex 
Python :: pandas shift columns up until value 
Python :: how to use prettytable with python 
Python :: cv2 yellow color range 
Python :: python run a system command 
Python :: breaking big csv into chunks pandas 
Python :: read pdf py 
Python :: how to open sound file in python 
Python :: how to click on button using python 
Python :: how to seperate words and number in a list 
Python :: pandas iterate over a series 
Python :: array as an input in python 
Python :: unlimited keyword arguments python 
Python :: http.server python 
Python :: python make dictionary based on list 
Python :: Add new column based on condition on some other column in pandas. 
Python :: shutil move overwrite 
Python :: how to extract numbers from a list in python 
Python :: load and image and predict tensorflow 
Python :: make sure text is on page selenium python 
Python :: change python version ubuntu 
Python :: making a function wait in python 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =