Home > other >  Python: how to solve this BUG?
Python: how to solve this BUG?

Time:02-06

According to the online program, a tkinter color reference program was improved and the effect is to show all tkinter default color, click on the color copy of the corresponding English name, but the content of the copy is always Black, could you tell me how to solve?
Please reply modified complete code , thank you

 
The from tkinter import *
The from win10toast import ToastNotifier
The import sys
The import OS. Path
The import win32clipboard as w
The import win32con
The import win32api


Def set_clipboard (data) :
William ouchi penClipboard ()
W.E mptyClipboard ()
Baron etClipboardText (data)
W.C loseClipboard ()
Toaster [' text ']='successful copy color English name! Content: '+ data


Colors="' # FFB6C1 LightPink shallow pink
# FFC0CB Pink Pink
# DC143C Crimson red/scarlet
# FFF0F5 LavenderBlush violet red
# DB7093 PaleVioletRed weak violet red
# FF69B4 HotPink warm pink
# FF1493 DeepPink deep pink
The # C71585 MediumVioletRed violet red
Dark purple/# DA70D6 Orchid Orchid purple
Color # D8BFD8 Thistle Thistle
# DDA0DD name Plum Plum color/Plum
# EE82EE Violet Violet
# FF00FF Magenta Magenta/rosy
# FF00FF fuscia purple/lantern haitang
# 8 b008b DarkMagenta deep magenta
# 800080 Purple Purple
# BA55D3 MediumOrchid orchids in purple
# 9400 d3 DarkViolet dark violet
# 9932 cc DarkOrchid dark orchid purple
# 4 b0082 Indigo Indigo/purple blue
# 8 a2be2 BlueViolet blue violet
The # 9370 db MediumPurple purple
# 7 b68ee MediumSlateBlue in dark blue/medium plate rock
# 6 a5acd SlateBlue stone blue/SLATE blue
# 483 d8b DarkSlateBlue dark grey/dark blue SLATE blue
# E6E6FA Lavender pale Lavender purple/lilac
# F8F8FF GhostWhite ghost white
Pure Blue # 0000 ff Blue
The # 0000 CD MediumBlue blue
# 191970 MidnightBlue midnight blue
# 00008 b DarkBlue dark
# 000080 Navy Navy
# 4169 e1 RoyalBlue royal blue/royal blue
# 6495 Ed CornflowerBlue cornflower blue
Light steel blue # B0C4DE LightSteelBlue
# 778899 LightSlateGray bright blue grey/light SLATE grey
# 708090 SlateGray grey stone/SLATE grey
Flash blue/dodger blue # 1 e90ff DodgerBlue
# F0F8FF AliceBlue Alice blue
# 4682 b4 SteelBlue steel blue/metal gray
# 87 cefa LightSkyBlue bright sky blue
# 87 ceeb SkyBlue sky blue
# 00 BFFF DeepSkyBlue deep sky blue
Light blue # ADD8E6 LightBlue
# B0E0E6 PowderBlue powder blue/green gunpowder
Blue/# 5 f9ea0 CadetBlue army uniform blue
# F0FFFF Azure blue
# E0FFFF LightCyan nattierblue
# AFEEEE PaleTurquoise weak turquoise
# 00 FFFF Cyan blue
# 00 FFFF Aqua green/water
# 00 ced1 DarkTurquoise dark green gem
# 2 f4f4f DarkSlateGray dark SLATE grey/dark SLATE grey
# 008 b8b DarkCyan dark cyan
# 008080 the Teal color Teal
# 48 d1cc MediumTurquoise emerald in
# 20 b2aa LightSeaGreen shallow sea green
# 40 e0d0 Turquoise, Turquoise
# 7 fffd4 Aquamarine gemstone green
# 66 cdaa MediumAquamarine of gem green
# 00 fa9a MediumSpringGreen in spring green
# F5FFFA MintCream mint cream
# 00 ff7f SpringGreen spring green
In the # 3 cb371 MediumSeaGreen sea green
# 2 e8b57 SeaGreen sea green
# F0FFF0 Honeydew honey/Honeydew melon color
# 90 ee90 LightGreen light green
# 98 fb98 PaleGreen weak green
# 8 fbc8f DarkSeaGreen dark sea green
# 32 cd32 LimeGreen flashing green
# 00 ff00 Lime flashing green
# 228 b22 ForestGreen forest green
# 008000 Green, pure Green
# 006400 DarkGreen green
# 7 fff00 Chartreuse yellow/Chartreuse green
/# 7 cfc00 LawnGreen grass green grass green
# ADFF2F GreenYellow green
# 556 b2f DarkOliveGreen dark olive green
# 9 acd32 YellowGreen yellow-green
# 6 b8e23 OliveDrab olive brown
# F5F5DC Beige Beige/grey brown
Light chrysanthemum yellow # FAFAD2 LightGoldenrodYellow
# FFFFF0 Ivory Ivory
# FFFFE0 LightYellow buff
# FFFF00 Yellow Yellow
# 808000 Olive Olive
Dark tan/deep card # BDB76B DarkKhaki ji cloth
# FFFACD LemonChiffon lemon silk
# EEE8AA PaleGoldenrod grey color chrysanthemum yellow/pale kirin
# F0E68C cloth ji tan/card cloth
# FFD700 Gold Gold
# FFF8DC Cornsilk corn silk color
# DAA520 Goldenrod Kim yellow
Kim # B8860B DarkGoldenrod dark yellow
# FFFAF0 FloralWhite flower white
# FDF5E6 OldLace old old lace color/
# F5DEB3 Wheat buff/Wheat color
# FFE4B5 Moccasin deerskin color/deer leather boots
# FFA500 Orange Orange
# FFEFD5 PapayaWhip's color/papaya
Color # FFEBCD BlanchedAlmond Bai Xing
# FFDEAD NavajoWhite native Navajo white/white
# FAEBD7 AntiqueWhite antique white
# D2B48C Tan
it's light brown.# DEB887 BurlyWood hard wood color
# FFE4C4 Bisque greenware yellow
# FF8C00 DarkOrange deep orange
# FAF0E6 Linen Linen
Color # CD853F Peru Peruvian
# FFDAB9 PeachPuff peach color
# F4A460 SandyBrown sandy brown
# D2691E Chocolate Chocolate
# 8 b4513 SaddleBrown heavy tan/saddle brown
# FFF5EE Seashell seashells
# A0522D Sienna loess ochre
# FFA07A LightSalmon shallow color salmon
# FF7F50 Coral corals
# FF4500 OrangeRed orange-red
# E9967A DarkSalmon deep color fresh salmon/
# FF6347 Tomato, Tomato red
# FFE4E1 MistyRose light rose/mist rose
# FA8072 Salmon, fresh meat/Salmon color
# FFFAFA Snow white
# F08080 LightCoral pale coral
# BC8F8F RosyBrown rose brown
India red # CD5C5C IndianRed
# FF0000 Red pure Red
# A52A2A Brown Brown
# B22222 FireBrick brick color/brick
# 8 b0000 DarkRed deep red
# 800000 Maroon chestnut
Pure White # FFFFFF White
# F5F5F5 WhiteSmoke white smoke
# DCDCDC Gainsboro light gray
# D3D3D3 LightGrey light gray
# C0C0C0 Silver Silver
# A9A9A9 DarkGray dark grey
# 808080 Gray, Gray
# 696969 DimGray dim gray
# 000000 Black pure Black "'

Win=Tk ()

Root=Frame (win)
Root. Pack ()
I=0
Colcut=5
Win the title (' Python tkinter default color reference)

For color in colors. The split (' \ n ') :
Sp=color. The split (')
Try:
The Button (root, text=color, bg=sp [1], bd=0, the command=lambda: set_clipboard (sp) [1]). The grid (row=int (I/colcut),
The column=I % colcut,
Sticky=W + E + N + S)
Except:
Print (" err ", color)
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related