tkinterでテキストボックスに絵文字を表示させる

実現したいこと

ボタンを押すと絵文字がテキストボックスに表示される

前提

ここに質問の内容を詳しく書いてください。
tkinterでLINEのようなチャット画面を作成しています。
絵文字のボタンを押したとき、テキストボックスの中に表示させたいです。
テキストボックス内に文章があった場合、その文章の後ろに絵文字が連なるようにしたいです

発生している問題・エラーメッセージ

エラーメッセージ

python

import tkinter as tk

def button_push():
print("ボタンが押されました!")

main_win = tk.Tk()
main_win.title("テスト用ウィンドウ")
main_win.geometry("300x500")

frame = tk.Frame(main_win,height=300, width=500, pady=10, padx=10,bg='skyblue')
txt = tk.Entry(width=35)
txt.place(x=15, y=450)
button1=tk.Button(main_win,text="ボタン1",command=button_push)
button1.place(x=240,y=450)

img = tk.PhotoImage(file="にこちゃん.png")
small_img = img.subsample(20, 20)
button2 = tk.Button(main_win, image=small_img)
button2.place(x=15,y=300)
frame.pack()

試したこと

補足情報(FW/ツールのバージョンな

画像を添付できませんでした

コメントを投稿

0 コメント