Created
May 8, 2021 06:57
-
-
Save rodrigo-x/04dc4cca7b8d9a96138550f792faf00f to your computer and use it in GitHub Desktop.
color chooser tk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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