'Tuple formatting

Hey is a small code on QR generator. When I scan the QR code I get a tuple e.g ('Name: Michael','ID:22222222','tel:5555555') But I want it every entry on its own line. On the code there is a commented section, I was trying to display the QR code as a message box saying successfully generated but the sizing has also challenged me. Kindly help.

from tkinter import *

import qrcode
from PIL import ImageTk, Image

root = Tk()
root.title("Nachu BodaBoda Co-operative")
root.geometry("786x320")
root.config(bg="#fe6431")
root.iconbitmap("Ndacha Cooperative logo.ico")
root.resizable(False, False)


    def generate():
        data = (
                f'NAME: {fname.get()}',
                f"ID NUMBER: {id_no.get()}",
                f" MOBILE NUMBER: {tel_no.get()}",
                f" NUMBER PLATE: {plate_no.get()}",
                f" STAGE: {stage_name.get()}",
                f" STAGE NUMBER: {stage_no.get()}",
                f" STAGE CHAIRMAN: {stage_chair.get()}",
                f" CHAIRMAN'S NUMBER:{chairtel_no.get()}"
        )
    
        # data = ("({})".format(", ".join(tup)))
        # data.insert(f'{fname.get()}')
        # for item in tupe:
        #     data = str(item)
    
        qr = qrcode.make(data)
        qr.save("Qrcodes/" + str(fname.get()) + ".png")
    
    
    #     global Image
    #     Image = PhotoImage(file="Qrcodes/"+str(fname.get())+".png")
    #     Image_view.config(image=Image)
    #
    # Image_view = Label(root, width=35, height=14, bg="#fe6431" )
    # Image_view.grid(padx=450, pady=35)
    
    
    frame = Frame(root, width=786, height=318)
    frame.place(anchor='center', relx=0.5, rely=0.5)
    
    img = ImageTk.PhotoImage(Image.open("Ndacha Cooperative.png"))
    
    label = Label(frame, image=img)
    label.pack()
    
    Label(root, text="Full Name:", fg="white", bg="#fe6431", font=12).place(x=15, y=50)
    
    fname = Entry(root, width=25, font="arial 12")
    fname.place(x=100, y=50)
    
    Label(root, text="ID Number:", fg="white", bg="#fe6431", font=12).place(x=15, y=80)
    
    id_no = Entry(root, width=25, font="arial 12")
    id_no.place(x=100, y=80)
    
    Label(root, text="Mobile No:", fg="white", bg="#fe6431", font=12).place(x=15, y=110)
    
    tel_no = Entry(root, width=25, font="arial 12")
    tel_no.place(x=100, y=110)
    
    Label(root, text="Plate No:", fg="white", bg="#fe6431", font=12).place(x=15, y=140)
    
    plate_no = Entry(root, width=25, font="arial 12")
    plate_no.place(x=100, y=140)
    
    Label(root, text="Stage Name:", fg="white", bg="#fe6431", font=12).place(x=15, y=170)
    
    stage_name = Entry(root, width=22, font="arial 12")
    stage_name.place(x=127, y=170)
    
    Label(root, text="Stage No:", fg="white", bg="#fe6431", font=12).place(x=15, y=200)
    
    stage_no = Entry(root, width=22, font="arial 12")
    stage_no.place(x=127, y=200)
    
    Label(root, text="Stage Chair:", fg="white", bg="#fe6431", font=12).place(x=15, y=230)
    
    stage_chair = Entry(root, width=22, font="arial 12")
    stage_chair.place(x=127, y=230)
    
    Label(root, text="Chairman Tel:", fg="white", bg="#fe6431", font=12).place(x=15, y=260)
    
    chairtel_no = Entry(root, width=23, font="arial 12")
    chairtel_no.place(x=120, y=260)
    
    Button(root, text="Generate", width=20, height=1, bg="#fe6431", fg="#ffffff", command=generate).place(x=180, y=290)
    
    root.mainloop()

Kindly assist.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source