0

Here is my code:

def nameProjectWindow():

    tkWindow = Tk(className = 'Export Project')
    tkWindow.geometry("500x500")

    fileNameLabel = Label(tkWindow, text="File Name").grid(row=0, column=0)
    fileNameVar = StringVar()
    fileNameEntry = Entry(tkWindow, textvariable=fileNameVar).grid(row=0, column=1)

    save_btn = ttk.Button(tkWindow, text = 'Save File!', command = lambda : SaveFile())
    save_btn.pack(side = TOP, pady = 20,padx = 50)


def SaveFile():
   data = [('All tyes(*.*)', '*.*')]
   file = asksaveasfile(filetypes = data, defaultextension = data)

I think my save file function is good, but I'm having trouble creating a save button. When I'm at the name project window there's no save project button.

Edit

Here's the window: enter image description here

martineau
  • 119,623
  • 25
  • 170
  • 301
chrisHG
  • 80
  • 1
  • 2
  • 18
  • This code will give you error if you run it, you are trying to use `grid()` and `pack()` together, just use one of the geometry managers in one window – Delrius Euphoria Dec 08 '20 at 07:49
  • Off-topic: Note that the `grid()` method, like `pack()`, _always_ returns `None`, so that is the value assigned to that the variables `fileNameLabel ` and `fileNameEntry `. – martineau Dec 08 '20 at 09:06

0 Answers0