How to make a "text=example" a "text=Function" with Tkinter-Python

Viewed 24

im new to python and tkinter and i wanted to make a program that change the value of the button in function of the OptionMenu choice that is selected.

from tkinter import *
import random
import os
import time
from tkinter import StringVar

root = Tk()
root.title("Multi Tool")
root.geometry("400x400")

def dr1(drop1):
    drop1.get()
    print(drop1)

drop1 = StringVar()
drop1.set("Choisit")


drop = OptionMenu(root, drop1, "Pile ou Face", "*** ou Pas ***", "Nombre au hasard", "Jeux aux hasard", "Mode de jeu au hasard", "Ban ou pas Ban + Temp du Ban")
drop.pack()

button = Button(root, text=dr1).pack()

root.mainloop()

But it give me a button = Button(root, text=dr1.get).pack() AttributeError: 'function' object has no attribute 'get'

0 Answers
Related