Тёмный

Python GUI open a file (filedialog) 📁 

Bro Code
Подписаться 2,1 млн
Просмотров 97 тыс.
50% 1

Опубликовано:

 

16 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 77   
@BroCodez
@BroCodez 4 года назад
from tkinter import * from tkinter import filedialog def openFile(): filepath = filedialog.askopenfilename(initialdir="C:\\Users\\Cakow\\PycharmProjects\\Main", title="Open file okay?", filetypes= (("text files","*.txt"), ("all files","*.*"))) file = open(filepath,'r') print(file.read()) file.close() window = Tk() button = Button(text="Open",command=openFile) button.pack() window.mainloop()
@vladglassofficial
@vladglassofficial 3 года назад
How to print variable "filepath" outside a function?
@sportiano3348
@sportiano3348 2 года назад
but i want create text editor and i want to from the user open file.txt to show on text editor ? any way to this
@EltonSenne
@EltonSenne 2 года назад
Simple and fast, exact what I need!
@KhoaNguyen-bk2kv
@KhoaNguyen-bk2kv 3 года назад
"hey you yeah i'm talking to you". A useful video, thanks bro.
@nishadshivprakash
@nishadshivprakash 3 года назад
Awesome ◉‿◉. Explain good to understand. And thanks for sharing code in description. As I am new, this video is very helpful for me.
@amirekhalili
@amirekhalili 11 месяцев назад
Thanks for simple explanation
@kingshahzad78
@kingshahzad78 5 дней назад
I said fantastic before I see you video Sir! Because I know your teachings❤❤❤❤
@deepdaddy1208
@deepdaddy1208 4 года назад
great vid bro, im not a bot, just clarifying
@BroCodez
@BroCodez 4 года назад
that's what a bot would say lol
@Amir_Plays_non_stop
@Amir_Plays_non_stop 3 года назад
@@BroCodez 🤣🤣🤣🤣🤣
@digitalmachine0101
@digitalmachine0101 6 месяцев назад
Good information
@vadzimfiadotsyeu2967
@vadzimfiadotsyeu2967 3 года назад
If you have errors about bad file type - use the following construction: filetypes=[("Text files", "*.txt"), ("Rulename", "file_extension")]
@yosefgreen4187
@yosefgreen4187 2 года назад
what I like most is that you put the snippet code just in the description, thanks! // a better easy solution to open file from dialog and close it after choosing the file: from tkinter import * from tkinter.filedialog import askopenfilename root = Tk() root.withdraw() file_path = askopenfilename() root.destroy()
@Data_Falcon
@Data_Falcon 4 месяца назад
BRO YOUR VIDEOS IS SO USEFUL
@user-nk4hd2lx9z
@user-nk4hd2lx9z 2 месяца назад
hi i from of venezuela, nice video
@martin-xq7te
@martin-xq7te 2 года назад
Great short to the point tutorial. Thank you
@shahabkhokhar4039
@shahabkhokhar4039 2 года назад
thank you so much! this is exactly what I needed! subscribed
@martinrosschou
@martinrosschou Месяц назад
I'm about 2 hours in to my Python learning. I removed all the button stuff, and just did openFile() instead.
@peromiracomodudan...6876
@peromiracomodudan...6876 2 года назад
Nice done
@exploretheuniverse1686
@exploretheuniverse1686 5 месяцев назад
thank you .....keep it up
@piotrkopcewicz5227
@piotrkopcewicz5227 Год назад
Great tutorial. Love it !!:)
@davutselamiozkahraman8200
@davutselamiozkahraman8200 Год назад
Very good video
@KumarAnalytic
@KumarAnalytic 2 года назад
Great Video
@AniruddhaGA
@AniruddhaGA 3 года назад
bad file type "*.txt", should be "typeName {extension ?extensions ...?} ?{macType ?macTypes ...?}?"
@tanphatnguyen4873
@tanphatnguyen4873 Год назад
I got it. Thank you so much !
@anaschafik6109
@anaschafik6109 Год назад
this tutorial helped me , Thank you
@seifelshlkany5032
@seifelshlkany5032 2 года назад
Thank you very much! you are amazing
@منوعاتمنوعات-ح1غ
🥰🥰🥰🥰🥰🥰
@JimmyZyzz
@JimmyZyzz 3 года назад
Excelente vídeo! Me sirvió de mucho. Saludos
@chetanpatteparapu7600
@chetanpatteparapu7600 3 года назад
Thank you, this is helpful.
@davidrose1999
@davidrose1999 2 года назад
Cool Video Cheers
@imamsantoso7994
@imamsantoso7994 3 месяца назад
Thank you
@rolfjohansen5376
@rolfjohansen5376 Год назад
RuntimeError: main thread is not in main loop
@lovebaking2503
@lovebaking2503 Год назад
thanks for sharing the code
@EissaAlahdul
@EissaAlahdul 2 года назад
شكرا
@personanongrata2339
@personanongrata2339 Год назад
thank you so much
@mohamedtaki8748
@mohamedtaki8748 3 года назад
Thank you very much
@bjh5878
@bjh5878 3 года назад
Thank you !!
@sonalivishwakarma9351
@sonalivishwakarma9351 Год назад
Thank you 🙂
@paraglide01
@paraglide01 3 года назад
Thanks man, do know if a filepicker is in python?
@beingzero7541
@beingzero7541 2 года назад
Wow!!!!
@akashaabeysundara8454
@akashaabeysundara8454 5 месяцев назад
thanks bro
@maxsuspochtam1489
@maxsuspochtam1489 7 месяцев назад
thank u
@jhassee
@jhassee Год назад
loveIT
@user-kt1ec4zo6e
@user-kt1ec4zo6e Год назад
Hello Sir, How to make a copy paste file when i make file name textbox then search file in network drive path and paste user destination path to set how to do this ?
@Artzaint
@Artzaint 2 года назад
Awesome video, but what if i want to print it on a Textbox?
@tusharbhatriya3700
@tusharbhatriya3700 3 года назад
Bro if I want to show that txt or any file inside gui then what I can write?
@AniGuy-sm7iy
@AniGuy-sm7iy 2 года назад
hey bro, why didn't you type the "master" when making the open button ?
@abdoularbi5718
@abdoularbi5718 3 года назад
thank you bro
@jeremy_ching
@jeremy_ching 2 года назад
bu'on bu'on
@loiczeq5551
@loiczeq5551 2 года назад
thanks :)
@KumarAnalytic
@KumarAnalytic 2 года назад
I subscribed you now
@minhct2511
@minhct2511 2 года назад
Can you pls show me what I have to do if I want to show the text in the black window when I opened file
@philtoa334
@philtoa334 3 года назад
My name is Pizza i like Bro. : )
@gustavoaponte1814
@gustavoaponte1814 Год назад
meow meow meow~!
@duyoan6821
@duyoan6821 Год назад
i was here
@naturesounds1427
@naturesounds1427 3 года назад
How did you add the open menu with tkinter sign on your pycharm menu am confused, plz help
@hasansolak23
@hasansolak23 3 года назад
You gotta add those nuclear launch codes to the description too...
@gwyne4192
@gwyne4192 Год назад
Is it possible to open multiple files and return multiple directories?
@umartahir2043
@umartahir2043 3 года назад
Great video!!! What if I want to upload it to SQLite
@aneverdayhobbiest2837
@aneverdayhobbiest2837 8 месяцев назад
comment to help with algorithm.
@dwithidaya4168
@dwithidaya4168 3 года назад
Sir, How can I open a excel sheet within the created gui window
@ГрГафф
@ГрГафф 3 года назад
Как же прекрасно, что здесь есть субтитры на русском. Спасибо огромное!
@vladglassofficial
@vladglassofficial 3 года назад
Как мне получить доступ к переменной filepath, не объявляя её глобальной, и не вызывая функцию
@ГрГафф
@ГрГафф 3 года назад
@@vladglassofficial По сути в питоне переменные это ссылки. И если создать переменную в функции, и с тем же названием вне функции. Это будут разные переменные, отвечающие за разные участки памяти (но на вид тебе будут казаться одинаковыми). Если тебе нужно чтото делать с переменной после исполнения функции, то return (возврати то что тебе нужно). Если тебе вообще не хочется использовать функцию, то создай переменную в основном коде. Но я не совсем понимаю вопрос, т.к. не знаю зачем тебе это нужно.
@wakkendul1434
@wakkendul1434 3 года назад
Bro how I want to write when I only need print file name and not the file path.. can u help me please..
@bigdeallo
@bigdeallo Год назад
If you don't select a file and close the window. You get a FileNotFoundError
@riyapalkar1178
@riyapalkar1178 3 года назад
How to add this open button to submenu and open it through submenu . Plzs help 🙏
@KenDedes94
@KenDedes94 2 года назад
Can Excel files works on Tkinter?
@promax1st
@promax1st 2 года назад
:)
@mohitjain1804
@mohitjain1804 2 года назад
How we can save the image on click
@KEVINSURIEL
@KEVINSURIEL 6 месяцев назад
How about multi files
@joelkafesu6757
@joelkafesu6757 3 года назад
how can i put a button on this GUI that run a .py script
@seu_policial9463
@seu_policial9463 5 месяцев назад
coment
@arpanshah355
@arpanshah355 Год назад
comment
Далее
Python GUI save a file (filedialog) 💾
10:26
Просмотров 42 тыс.
Modern Graphical User Interfaces in Python
11:12
Просмотров 1,5 млн
😂😂
00:16
Просмотров 969 тыс.
Merab vs Sean underway!! 🚨 #ufc306
00:23
Просмотров 1,2 млн
World’s Tallest Man VS Shortest Woman!
15:07
Просмотров 18 млн
how NASA writes space-proof code
6:03
Просмотров 2,2 млн
Vim in 100 Seconds
11:53
Просмотров 1,1 млн
😂😂
00:16
Просмотров 969 тыс.