Skip to content
Snippets Groups Projects
Commit 6af26043 authored by Paul Chevalier's avatar Paul Chevalier
Browse files

Merge branch 'paul' into jejew for python files

parents 058eaed7 5d134b0f
No related branches found
No related tags found
No related merge requests found
File added
No preview for this file type
No preview for this file type
output_image.png

37.9 KiB

import time
from PIL import Image, ImageEnhance, ImageTk
import tkinter as tk
def adjust_transparency(image_path, charge_percentage):
# Open the image
image = Image.open(image_path).convert("RGBA")
# Split the image into channels
r, g, b, alpha = image.split()
# Adjust the alpha channel based on charge percentage
alpha = alpha.point(lambda p: p * (charge_percentage / 100))
# Merge channels back
return Image.merge("RGBA", (r, g, b, alpha))
def fake_charging(image_path):
# Create a Tkinter window
root = tk.Tk()
root.title("Charging...")
# Load the initial image
charge_percentage = 0
image = adjust_transparency(image_path, charge_percentage)
tk_image = ImageTk.PhotoImage(image)
# Create a label to display the image
label = tk.Label(root, image=tk_image)
label.pack()
def update_image():
nonlocal charge_percentage, tk_image
if charge_percentage < 100:
# Increment charge percentage smoothly
charge_percentage += 1
# Adjust transparency and update the image
image = adjust_transparency(image_path, charge_percentage)
tk_image = ImageTk.PhotoImage(image)
label.config(image=tk_image)
label.image = tk_image
root.title(f"Charging... {charge_percentage}%")
root.after(50, update_image) # Update every 50ms for smoother transition
else:
root.title("Charging complete!")
# Start updating the image
update_image()
root.mainloop()
def main():
# Use the specified image
image_path = "LogoSymbole_canard.png"
fake_charging(image_path)
if __name__ == "__main__":
main()
......@@ -22,8 +22,13 @@ def single_threaded():
# Multi-threaded execution
def multi_threaded():
start_time = time.time()
<<<<<<< HEAD
num_threads = 2
step = 10_000_000 // num_threads
=======
num_threads = 8
step = 100_000_000 // num_threads
>>>>>>> 73f7a464704d2fa11671ba78a16771abe843918a
threads = []
results = [0] * num_threads
......
import multiprocessing
print(f"Cœurs physiques : {multiprocessing.cpu_count() // 2}")
print(f"Cœurs logiques : {multiprocessing.cpu_count()}")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment