Question:
I am unable to get a output of my function on my label1 when I click on button 1, please help?
I have written the program and made changes just to display the value on label1 when button1 is pressed. Notice the code on line 13, label1.config() is used to refresh the text attribute of the label1. Below is the screenshot of the code to check indentation.
Below is the output of the code:
Before the button B1 is pressed:
After B1 is pressed:
Below is the code to copy:
from tkinter import * HEIGHT = 300 WIDTH = 400 root = Tk() def count(): count1=0 for i in range(1,1001): num = i*i if num> 1000: count1+=1 print ("Numbers in range 1 to 1000 that are non perfect squares are:",count1) label1.config(text=count1) #CHANGED LINE canvas = Canvas(root,height=HEIGHT, width =WIDTH) canvas.pack() frame=Frame(root,bg='green', bd=5) frame.place(relx=0.5,rely=0.1, relwidth=0.75, relheight= 0.4, anchor='n') button1= Button(frame, text='B1', font = 40, command=count) button1.place(relx=0, relwidth=0.25, relheight= 0.5) lowerframe = Frame(root, bg='green', bd=10) lowerframe.place(relx=0.5, rely=0.6, relwidth=0.75, relheight=0.2, anchor='n') label1=Label(lowerframe,bg='white', font=30) label1.place(relwidth=0.25, relheight=0.8, relx=0) root.mainloop()
Question: I am unable to get a output of my function on my label1 when I...
When i run my python code i get the following error... and im not sure how to fix the error, can someone help me? ____________________Hers my Code__________________ import face_recognition import cv2 # Get a reference to your webcam video_capture = cv2.VideoCapture(0) # Load a sample picture of yourself and learn how to recognize it. kyle_image = face_recognition.load_image_file("kyle.jpg") kyle_face_encoding = face_recognition.face_encodings(kyle_image)[0] # Load a second sample picture and learn how to recognize it. ##lauren_image = face_recognition.load_image_file("lauren.jpg") ##lauren_face_encoding = face_recognition.face_encodings(lauren_image)[0] # Load...
could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...