যদি আপনি কখনো চিন্তা করেছেন हों যে পাইথন অ্যাপ্লিকেশনে ডায়ালগ বক্স কীভাবে কাজ করে, তবে আপনি সম্ভবত Tkinter-এ filedialog মডিউল সম্পর্কে শুনেছেন। filedialog মডিউলে সিস্টেমে ফাইল নিয়ে কাজ করার জন্য বিভিন্ন ধরণের ডায়ালগ প্রদর্শন করার বেশ কিছু বিল্ট-ইন ফাংশন রয়েছে।
বেশিরভাগ ক্ষেত্রে, আমরা সিস্টেম থেকে একটি ফাইল ব্রাউজ করে খোলার জন্য filedialog.askopenfilename() ফাংশন ব্যবহার করি। ফাইল টাইপের সিলেকশনের উপর ভিত্তি করে, স্ক্রিপ্টটি রাইট বা রিড অপারেশন করার জন্য প্রোগ্রাম করা থাকে।
একবার ফাইল খোলা হলে, আপনি যেকোনো মোডে ফাইল খুলতে এবং অপারেশন করতে open(file, 'mode') ফাংশন ব্যবহার করতে পারেন। এটি প্রদর্শন করতে, ধরা যাক আমরা একটি অ্যাপ্লিকেশন তৈরি করব যা ব্যবহারকারীকে একটি টেক্সট ফাইল খোলার জন্য বলবে। একবার ফাইল সিলেক্ট ও ওপেন হলে, আমরা অপারেশনের "read" মোড ব্যবহার করে এই ফাইলটি পড়তে পারি।
উদাহরণ
# লাইব্রেরি ইমপোর্ট করুন
from tkinter import *
from tkinter import filedialog
# উইন্ডো ইনস্ট্যান্স তৈরি করুন
win = Tk()
# উইন্ডোর জ্যামিতি সেট করুন
win.geometry("700x300")
# একটি লেবেল তৈরি করুন
Label(win, text="Click the button to open a dialog", font='Arial 16 bold').pack(pady=15)
# সিস্টেমে ফাইল খোলার ফাংশন
def open_file():
filepath = filedialog.askopenfilename(title="Open a Text File", filetypes=(("text files", "*.txt"), ("all files", "*.*")))
file = open(filepath, 'r')
print(file.read())
file.close()
# ডায়ালগ ট্রিগার করার জন্য একটি বাটন তৈরি করুন
button = Button(win, text="Open", command=open_file)
button.pack()
win.mainloop()
আউটপুট
উপরের কোড রান করলে একটি উইন্ডো দেখাবে যেখানে একটি ডায়ালগ খোলার জন্য একটি বাটন থাকবে।

একটি টেক্সট ফাইল সিলেক্ট ও ওপেন করুন এবং কনসোলে ফাইলের সारी কন্টেন্ট প্রদর্শিত হবে।
Centralized Database Vs Blockchain A blockchain can be both permissionless (like Bitcoin or Ethereum) or permissioned (like the different Hyperledger blockchain frameworks). A permissionless blockchain is also known as a public blockchain, because anyone can join the network. A permissioned blockchain, or private blockchain, requires pre-verification of the participating parties within the network, and these parties are usually known to each other. Types of Blockchains The choice between permissionless versus permissioned blockchains should be driven by the particular application at hand (or use case). Most enterprise use cases involve extensive vetting before parties agree to do business with each other. An example where a number of businesses exchange information is supply chain management. The supply chain management is an ideal use case for permissioned blockchains. You would only want trusted parties participating in the network. Each participant that is involved in the supply chain would require permissions to execute transactions on the blockchain. These transactions would allow other companies to understand where in the supply chain a particular item is.