Python Forum
[TKINTER] Problems creating directories in a selected path
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[TKINTER] Problems creating directories in a selected path
#3
Thank you for answering my question. Big Grin

(Aug-10-2021, 07:57 AM)Larz60+ Wrote: You need to pass the sourcePath

import os
from tkinter import *
import tkinter.filedialog
 
janela = Tk()
janela.title('TESTE')
janela.geometry('200x200')
 
def createDirectory(sourcePath):
    os.chdir(sourcePath)
    directory = 'Data'
    os.makedirs(directory)
 
def selectDirectory():
    sourcePath = filedialog.askdirectory()
    createDirectory(sourcePath)
     
selectButton = Button(janela, text='Select Diretory', width=15, command=selectDirectory)
selectButton.grid(column=0, row=0, padx=10, pady=10)
 
janela.mainloop()
Reply


Messages In This Thread
RE: [TKINTER] Problems creating directories in a selected path - by Vulera - Aug-10-2021, 06:38 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems trying to position images with Tkinter emont 3 790 Dec-12-2023, 07:20 AM
Last Post: menator01
  Creating a function interrupt button tkinter AnotherSam 2 5,566 Oct-07-2021, 02:56 PM
Last Post: AnotherSam
  [Tkinter] Python - Tkinter : How can I send path Excel from GUI to scripte johnjh 2 4,324 Aug-28-2020, 05:38 PM
Last Post: maaad
  Tkinter having problems with packing labels? wallgraffiti 0 1,547 Aug-02-2020, 09:26 AM
Last Post: wallgraffiti
  [Tkinter] Problems to display Web Scraping values in Tkinter Lucas_Ribeiro 0 1,577 May-07-2020, 12:36 AM
Last Post: Lucas_Ribeiro
  [Tkinter] Tkinter custom widget styling and creating custom theme karolp 6 4,868 May-06-2020, 06:11 PM
Last Post: karolp
  Creating and destroying dynamic labels in Tkinter MarcusRoberts 1 4,316 May-02-2020, 06:49 PM
Last Post: Yoriz
  tkinter.TclError: bad window path name kenwatts275 3 14,851 Apr-26-2020, 08:16 PM
Last Post: kenwatts275
  [Tkinter] Problem with tkinter when creating .exe file Jan_97 2 4,621 Feb-27-2020, 05:17 PM
Last Post: Jan_97
  tkinter frame sizing problems Lux 0 4,913 Aug-26-2017, 06:09 PM
Last Post: Lux

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020