آموزش پایتون | هوش مصنوعی | voidcompile
✅ جمع اعداد تا اولین عدد منفی! قسمت ۱۷ ام آموزش پایتون - بررسی کد def sum_until_negative(numbers): total = 0 for num in numbers: if num < 0: break # وقتی به عدد منفی رسید، حلقه رو متوقف کن total += num # عدد رو به جمع…
🎨 ساخت رابط گرافیکی با Tkinter – آموزش پروژهمحور پایتون
✅آموزش پایتون قسمت ۱۸ ام -آموزش و کد
🚀 در این آموزش پایتون با کمک کتابخانه محبوب Tkinter، یک رابط گرافیکی ساده ساختیم که با گرفتن نام کاربر، پیام خوشآمدگویی شخصیسازیشده نشون میده!
#LearnPython18@voidcompile
#LearnPython@voidcompile
💻@voidcompile
✅آموزش پایتون قسمت ۱۸ ام -آموزش و کد
🚀 در این آموزش پایتون با کمک کتابخانه محبوب Tkinter، یک رابط گرافیکی ساده ساختیم که با گرفتن نام کاربر، پیام خوشآمدگویی شخصیسازیشده نشون میده!
import tkinter as tk # Import the Tkinter library
# Create main window
window = tk.Tk()
window.title("Welcome App")
window.geometry("300x150")
# Function to display greeting
def greet():
name = entry.get() # Get text from entry box
label_result.config(text=f"Hello, {name}!") # Set the label text
# Entry label
label_prompt = tk.Label(window, text="Enter your name:")
label_prompt.pack(pady=5)
# Entry field
entry = tk.Entry(window)
entry.pack(pady=5)
# Button to trigger greeting
btn = tk.Button(window, text="Greet", command=greet)
btn.pack(pady=5)
# Result label
label_result = tk.Label(window, text="")
label_result.pack(pady=10)
# Start the GUI loop
window.mainloop()
#LearnPython18@voidcompile
#LearnPython@voidcompile
💻@voidcompile
🔥26❤21👍20🏆18💯17