Python3の勉強を始めました。まだサンプルコードの写経を行なっているレベルなのですが、以下のエラーが発生してしまいます。アドバイスお願いします。
macOSでVisualStudioCodeを使用しています。
発生している問題・エラーメッセージ
libc++abi.dylib: terminating with uncaught exception of type NSException Abort trap: 6
該当のソースコード
Python3
1import os,sys 2from tkinter import * 3import tkinter 4from tkinter import ttk 5from tkinter import filedialog 6from tkinter import messagebox 7 8# 参照ボタンのイベント 9# button1クリック時の処理 10def button1_clicked(): 11 typ = [("","*")] 12 dir = os.path.abspath(os.path.dirname(__file__)) 13 filepath = filedialog.askopenfilename(filetypes = typ,initialdir = dir) 14 file1.set(filepath) 15 16# button2クリック時の処理 17def button2_clicked(): 18 messagebox.showinfo('FileReference Tool', u'参照ファイルは↓↓\n' + file1.get()) 19 20if __name__ == '__main__': 21 # rootの作成 22 root = Tk() 23 root.title('FileReference Tool') 24 root.resizable(False, False) 25 26 # Frame1の作成 27 frame1 = ttk.Frame(root, padding=10) 28 frame1.grid() 29 30 # 参照ボタンの作成 31 button1 = ttk.Button(root, text=u'参照', command=button1_clicked) 32 button1.grid(row=0, column=3) 33 34 # ラベルの作成 35 # 「ファイル」ラベルの作成 36 s = StringVar() 37 s.set('ファイル>>') 38 label1 = ttk.Label(frame1, textvariable=s) 39 label1.grid(row=0, column=0) 40 41 # 参照ファイルパス表示ラベルの作成 42 file1 = StringVar() 43 file1_entry = ttk.Entry(frame1, textvariable=file1, width=50) 44 file1_entry.grid(row=0, column=2) 45 46 # Frame2の作成 47 frame2 = ttk.Frame(root, padding=(0,5)) 48 frame2.grid(row=1) 49 50 # Startボタンの作成 51 button2 = ttk.Button(frame2, text='Start', command=button2_clicked) 52 button2.pack(side=LEFT) 53 54 # Cancelボタンの作成 55 button3 = ttk.Button(frame2, text='Cancel', command=quit) 56 button3.pack(side=LEFT) 57 58 root.mainloop()
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。