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

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 :: django 2.2 disable cache settings.STATIC_URL 
Python :: pythoneer 
Python :: python text to speech 
Python :: how to use drop for file in python 
Python :: list of google colab deep learning tutorial 
Python :: equivalenci EN PYTHON DE INPUT EN C# 
Python :: download viper for python ubutunu 
Python :: tess real name from suits 
Python :: urllib.error.HTTPError: HTTP Error 502 docker redis 
Python :: pandas use map lambda to fillna python 
Python :: quadre 
Python :: python tkinter interface exoskeleton 
Python :: pyhdb cesu-8 
Python :: kivy on press call python function 
Python :: stitch two dictionary python 
Python :: django create username and password from csv 
Python :: merge nouns spacy 
Python :: what optimizer to simplernn 
Python :: zipfian distribution python 
Python :: To install a specific version, type the package name followed by the required version: 
Python :: c to python converter 
Python :: How to derive using sympy 
Python :: https://practice.geeksforgeeks.org/problems/coin-change2448/1 
Python :: not want to assign all values of a collection of values in python 
Python :: how to get tomorrow date in python 
Python :: compute difference of all the combinations of 2 arrays 
Python :: how to access range of tuples in python 
Python :: Python - Comment convertir la corde à la date 
Python :: softmax for nparray 
Python :: wget download file python magic 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =