Can anyone advise me on the following:
import tkinter as tk
from tkinter import simpledialog
from tkinter import messagebox
root = tk.Tk()
root.withdraw()
user_input = simpledialog.askstring(title = “Ticket Calculator”, prompt = "Enter ticket number: ")
tk.messagebox.showinfo(“Dropped number”, user_input[:5])
tk.messagebox.showinfo(“Remainder”, int(user_input[:5]) % 7)
user_input = int(user_input[:5] % 7)
remainder = int(user_input[:5] % 7)
if user_input == remainder:
True
else:
False
I need to get a True or False statement in the message box if the remainder is equal to the same number that has been spliced from the ticket number.
e.g.
123454
Spliced number will be 4
Working out the remainder it will also be 4
Thus my statement is True.
But I am struggling to get the True and False statments in the message box as well as an error with my IF statment:
user_input = int(user_input[:5] % 7)
~~~~~~~~~~~~~^
TypeError: not all arguments converted during string formatting
Is this an exam question? If so, we cannot help.
If that is not the case, then please format your code.
This guide might help when posting questions:
In general, your post will get a good answer if you’ve remembered to do the following:
Always search for existing answers first.
Provide as much information and context as possible.
Format your code.
Follow the Community Guidelines .
Reference Additional Resources
Before Starting a Topic, Search for Existing Answers
Before you start a new topic, check existing posts and use Google to see if your questions have already been addressed. This will very often give you an immediate answer! Crypti…
mtf
July 21, 2023, 6:38pm
3
Not sure that Python’s GUI is even taught on CC, but then a lot has been added to the curriculum in the past couple of years, so I could well be wrong. Does Flask use the native GUI?
At any length I don’t recognize that project and can only assume it is an outside project, maybe a class assignment. Can’t see it being a test question. Still, there is no way to help the user without running the code locally which I have no motivation to do. Maybe some other expertise with the Python GUI will come along. Won’t hold my breath.
1 Like
You’re right; it’s not taught on CC as far as I can tell.
I said “exam,” but I meant class assignment.
1 Like