Jun-07-2019, 05:35 PM
(This post was last modified: Jun-07-2019, 05:37 PM by Selfiatus1.)
Here is the full code:
import tkinter as tk from docx import Document HEIGHT = 500 WIDTH = 600 root = tk.Tk() root.title("Generator") canvas = tk.Canvas(root, height=HEIGHT, width=WIDTH) canvas.pack() background_image = tk.PhotoImage(file='bg123.png') background_label = tk.Label(root, image=background_image) background_label.place(x=-6, y=-6) #dropdown part # Create a Tkinter variable tkvar = tk.StringVar(root) choices = { 'broker','consultant','recruit'} tkvar.set('broker') # set the default option popupMenu = tk.OptionMenu(root, tkvar, *choices) popupMenu.place(x=260,y=95) def helloCallBack(): if tkvar == 'Broker': document = Document() document.add_heading("Broker") document.save('0034.docx') button = tk.Button(text="Generate", font=40, command=helloCallBack) button.place(x=230, y=380) root.mainloop()