Skip to content

Instantly share code, notes, and snippets.

@rodrigo-x
Created May 8, 2021 06:57
Show Gist options
  • Save rodrigo-x/04dc4cca7b8d9a96138550f792faf00f to your computer and use it in GitHub Desktop.
Save rodrigo-x/04dc4cca7b8d9a96138550f792faf00f to your computer and use it in GitHub Desktop.
color chooser tk
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
try:
import tkinter as tk
from tkinter import colorchooser
except ImportError as err:
print(err)
storage = []
root = tk.Tk()
def escolher_cor():
codigo_cor = colorchooser.askcolor(title ='Selecionar a cor')
storage.append(codigo_cor)
print()
button = tk.Button(root, text = 'Selecionar a cor',
command = escolher_cor)
button.place(x = 30, y = 30)
button.configure(justify = 'left', relief = 'ridge', bd=0,
background = 'white')
root.title('Tkinter - ColorChooser')
root.geometry('400x300')
root.resizable(False, False)
root.eval('tk::PlaceWindow . center')
root.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment