import numpy as np
import matplotlib.pyplot as plt
# ساخت یه دایره با اندازه یکسان در تمام جهتها
circle = plt.Circle((0, 0), 0.5, color='gray', fill=True)
# مختصات محورها تو حالت خاکستری روشن
x = np.linspace(-1, 1, 1000)
X, Y = np.meshgrid(x, x)
Z = np.sqrt(X*X + Y*Y)
# رسم محورها و دایره در یه نمودار
fig, ax = plt.subplots()
ax.contourf(X, Y, Z, levels=30, cmap='gray')
ax.add_artist(circle)
# رسم نمودار
plt.axis('scaled')
plt.show()
#نشون_دادن_کره_ماه
Coders
import numpy as np import matplotlib.pyplot as plt # ساخت یه دایره با اندازه یکسان در تمام جهتها c
کتابخونه هاشم که بلدین کدوما هستن
import tkinter as tk
import time
class TimerApp:
def init(self, master):
self.master = master
master.title("Timer App")
self.time_var = tk.StringVar()
self.time_var.set('00:00:00')
self.timer_label = tk.Label(master, textvariable=self.time_var, font=('Helvetica', 48))
self.timer_label.pack()
self.start_button = tk.Button(master, text="Start", command=self.start_timer)
self.start_button.pack()
self.running = False
def start_timer(self):
if not self.running:
self.running = True
self.start_button.config(text="Stop")
self.start_time = time.time()
self.update_timer()
else:
self.master.after_cancel(self.timer_job)
self.running = False
self.start_button.config(text="Start")
def update_timer(self):
elapsed_time = time.time() - self.start_time
hours, rem = divmod(elapsed_time, 3600)
minutes, seconds = divmod(rem, 60)
time_string = '{:02}:{:02}:{:02}'.format(int(hours), int(minutes), int(seconds))
self.time_var.set(time_string)
self.timer_job = self.master.after(1000, self.update_timer)
root = tk.Tk()
timer_app = TimerApp(root)
root.mainloop()
#ساخت_یک_تایمر_پیشرفته
این کد به شما کمک می کنه تا یه آهنگ رو از اینترنت دانلود کرده و در پوشه موسیقی ذخیره کنین
اول باید کتابخونه requests رو نصب کنین
pip install requests
بعدش با استفاده از کد زیر لینک آهنگ مورد نظر خود رو تو قسمت url قرار بدید
import requests
url = "https://example.com/song.mp3"
response = requests.get(url)
with open("music/song.mp3", "wb") as f:
f.write(response.content)
تو اینجا فایل mp3 با نام song تو پوشه music ذخیره می شه