#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 20 14:54:31 2023 @author: richardson """ import tkinter as tkr # needed to make GUI from PIL import ImageTk, Image # to put the image in a GUI # below are imports needed to put a graph in a GUI import matplotlib matplotlib.use('TkAgg') import numpy as np from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from matplotlib.figure import Figure # packages needed to make GUIs # (graphical user interfaces) window = tkr.Tk() window.attributes("-topmost", True) window.title("Bubba's Primes") window.geometry("900x800") lbl = tkr.Label(window,text="Howdy, here is some text.",font=('Arial',24)) lbl.grid(column=0,row=0) # top loft spot pf window lbl2 = tkr.Label(window,text="Please give N.",font=('Arial',24)) lbl2.grid(column=0,row=1) # top loft spot pf window txt = tkr.Entry(window,width=10,font=('Arial',24)) # makes a box for text to be filled in txt.grid(column=0, row=2) def isitprime2(nn): for j in range(2,nn): # range(2,nn) means the integers 2,3,4,...,lastj-1 # each time through the loop, j becomes 2, # then 3, then 4, ... # and the loop is run lastj-2 times. if nn%j==0: # need two = signs if you are #checking if an equation is true are not. # a==b means True if a=b, False # if a!=b. '!=' means not equal. # nn%j means nn mod j = remainder # when nn is divided by j. return False return True def whenYouClick(): N = int(txt.get()) # .get() retireves the text from the widget text1 = "The first "+str(N)+" primes are:" plist=[] j=2 while len(plist)