button.py

Created by wperez274

Created on September 09, 2023

491 Bytes


from kandinsky import *

# Get user input
user_input = input("Enter text: ")

# Clear the screen
fill_rect(0, 0, 320, 240, color(255, 255, 255))

# Draw the button outline
fill_rect(100, 100, 120, 40, color(0, 0, 0))  # Black outline

# Draw the button with user input inside (black foreground color)
fill_rect(102, 102, 116, 36, color(0, 128, 255))  # Blue button
draw_string(user_input, 130, 115, color(0, 0, 0))  # Black text

# Keep the display active
while True:
    pass

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.