Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to make a button in python

from tkinter import *  # Importing gui module
def button_function():  # The function that the button will run
	print("Text")
screen = Tk()  # Creating a screen
button_quit = Button(screen, text="Quit", command=lambda:quit)  # Creating a button
button_quit.pack()  # Putting the button on the screen
button2 = Button(screen, text="BUTTON TEXT", command=lambda:button_function())  # Creating another button
button2.pack()  # Putting that button on the screen
screen.mainloop  # Opening the screen
Source by www.python-lernen.de #
 
PREVIOUS NEXT
Tagged: #button #python
ADD COMMENT
Topic
Name
3+4 =