Arkhan
Arkhan

Reputation: 25

How to output something in tkinter when the output itself has been appear

hopefull you're all understand what i asked because i can't use English language good

so i want to output the value's variable after the output in the first appear

This is the code:

  def mat():
    global harga, jumlah, total, teks, Harga, Total_value
    harga_value, jumlah_value = int(harga.get()), int(jumlah.get())
    Harga.append(harga_value)
    Jumlah.append(jumlah_value)
    total = harga_value * jumlah_value
    Total_Belanja.append(total)
    #Total_value = sum(Total_Belanja)
    print(Harga)
    print(Jumlah)
    return mat

def inputNilai():
    global nilaiTotal, nilai
    nilai = 5000
    nilaiTotal.append(nilai)


tombol = FALSE
def perulangan():
    global tombol, output
    tombol = TRUE
    if tombol == TRUE:
        mat()
        #inputNilai()
    else:
        pass

output = Label(window, text = "Rp" + str(nilaiTotal))

So the first output is:first output

Then, i want to the second output in the same output as the first output is have a value, but it's still like that? how can i add the value in the second output?

Thank you, i hope you're understand what i asked

Upvotes: 0

Views: 48

Answers (1)

IJ_123
IJ_123

Reputation: 507

If you want to change the text that is displayed, you can use the .config() method.

Example: output.config(text="New text")

Upvotes: 1

Related Questions