Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
# tk_rgba_color_wheel.py import tkinter as tk from PIL import Image, ImageTk import math, colorsys size = 250 radius = 100 center = (size // 2, size // 2) image = Image.new("RGBA", (size, size), (0, 0, 0, 0)) pixels = image.load() for y in range(size): for x in range(size): dx = x - center[0] dy = y - center[1] distance = math.hypot(dx, dy) if distance <= radius: angle = math.atan2(dy, dx) hue = (angle + math.pi) / (2 * math.pi) r, g, b = [int(c * 255) for c in colorsys.hsv_to_rgb(hue, 1, 1)] alpha = int((1 - distance / radius) * 255) pixels[x, y] = (r, g, b, alpha) root = tk.Tk() root.title("tk RGBA Color Wheel") tk_image = ImageTk.PhotoImage(image) label = tk.Label(root, image=tk_image) label.pack() root.mainloop()
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)