0

理由が見つからない小さな問題があります。次の GUI があり、ボタンを押したときにのみトリガーされるプロシージャ内にあるにもかかわらず、実行するとメッセージ ボックスが表示されます。

メッセージボックスのみを表示する二次機能を作成しようとしても、問題は解決しませんでした。

助けてくれてありがとう...私が見ていない簡単な修正があると確信しています...

import tkinter as tk
from tkinter import ttk
import tkinter.messagebox
import jl_generator


def run():
    jl_generator.run_process()
    tkinter.messagebox.showerror('Done','Done')

def show():
    temp_list = user_input_list
    for i in range(0, len(user_input_list[0])):
        listBox.insert("", "end", values = (user_input_list[0][i],user_input_list[1][i],user_input_list[2][i],user_input_list[3][i],user_input_list[4][i],user_input_list[6][i],user_input_list[8][i]))


# Column Names for the TreeView
cols = ('Entity', 'Customer Nr', 'Account Code', 'Profit Centre', 'Partner Profit Centre', 'Amount', 'Nr Of Journal Lines')
# Input data for the tree view
user_input_list, journal_code = jl_generator.get_user_input()

#Creating the
root = tk.Tk()
root.title('JL Generator')

#Create the treeview
listBox = ttk.Treeview(root, columns=cols, show='headings')
for col in cols:
    listBox.heading(col, text=col)
listBox.grid(row=1, column=0, columnspan=3)

#-------------LABELS--------------
#Title Label
label = tk.Label(root, text="Journal Lines Generator", font=("Arial",30)).grid(row=0, columnspan=3)
#Journal Code Label
show_journal_code = tk.Label(root, text = 'Journal Code = ' + journal_code).grid(row=6, column=1)
#Number of Journal Lines Label
show_number_of_journal_lines = tk.Label(root, text = 'Number of Journal Lines = ' + str(sum(user_input_list[8][i] for i in range(0, len(user_input_list[0]))))).grid(row=5, column=1)

#------------BUTTONS-----------
#Run the Generation
run_process = tk.Button(root, text="Generate JLs", width=15, command=run()).grid(row=4, column=1)
#Show the input data
showScores = tk.Button(root, text="Show Input", width=15, command=show).grid(row=4, column=0)
#Close the window
closeButton = tk.Button(root, text="Exit", width=15, command=exit).grid(row=4, column=2)


root.mainloop()
4

1 に答える 1