Day 066 - Project 66 : Calculator

If you have any questions, comments or issues with this project please post them here!

So I have typed the code out exactly as it is within the lesson, but there is no text window like there should be. I tested the code outside of Replit just to make sure it wasn’t a bug, but it didn’t work there either. It seems like there is something missing.

Can you please share the code? I may or may not be up to day 66

import tkinter as tk

window = tk.Tk()
window.title(“Groovey Bot”) # Sets the name of the window in the border
window.geometry(“300x300”) # Sets the size of the window in pixels

label = 0

def updateLabel():
global label
label += 1
hello[‘text’] = label

hello = tk.Label(text = label) # Creates a text box
hello.pack() # ‘pack’ places the element on the screen

button = tk.Button(text = “Don’t Click me!”, command = updateLabel) # Creates a button
button.pack()

text = tk.Text(window, height=1, width=50)
text.pack

tk.mainloop()

There should be nothing being printed. There are no print statements so its working as intended. @DavidAtReplit can say if this is intentional.

It’s supposed to put a text box that you can type into in the main window.

The next step in the lesson is using information that is typed into that text box.

I’ll grab my original solution repl and take a look

Is this not the code we put in the solution? https://replit.com/@DavidAtReplit/Day-66-Solution-1#main.py

And just to clarify the text box in this is just a label, it’s not meant to be typed into - the buttons are supposed to do the work

Yes, I figured it out. the text.pack was missing the () at the end. I watched the video again and noticed that it was in the video, but not in the tutorial window.

And the issue was before I got to the project, it was on the 2nd slide “Adding Text”

2 Likes