Default window colour Tkinter and hex colour codes

前端 未结 7 1269
无人共我
无人共我 2021-02-07 12:52

I would like to know the default window colour in Tkinter when you simply create a window:

root = Tk()

If there is one, it is possible to set w

相关标签:
7条回答
  • 2021-02-07 13:19

    I'm pretty sure it's #DDDDDD. I can't tell the difference between a button that I've specifically colored with bg='#ffffdffffd' and one that was colored with the default color.

    0 讨论(0)
  • 2021-02-07 13:20

    Unfortunately this list is not ordered by hue, but rather alphabetically. However, it does contain all colors used by Tkinter and their corresponding hex codes (I found the list of colors at this site, which seems to be some sort of Tkinter manual, then I used Python to convert their listed RGB values to Hex). Hope this helps someone!

            {hex: '#F0F8FF', name: 'AliceBlue'},
            {hex: '#FAEBD7', name: 'AntiqueWhite'},
            {hex: '#FFEFDB', name: 'AntiqueWhite1'},
            {hex: '#EEDFCC', name: 'AntiqueWhite2'},
            {hex: '#CDC0B0', name: 'AntiqueWhite3'},
            {hex: '#8B8378', name: 'AntiqueWhite4'},
            {hex: '#00FFFF', name: 'agua'},
            {hex: '#7FFFD4', name: 'aquamarine'},
            {hex: '#7FFFD4', name: 'aquamarine1'},
            {hex: '#76EEC6', name: 'aquamarine2'},
            {hex: '#66CDAA', name: 'aquamarine3'},
            {hex: '#458B74', name: 'aquamarine4'},
            {hex: '#F0FFFF', name: 'azure'},
            {hex: '#F0FFFF', name: 'azure1'},
            {hex: '#E0EEEE', name: 'azure2'},
            {hex: '#C1CDCD', name: 'azure3'},
            {hex: '#838B8B', name: 'azure4'},
            {hex: '#F5F5DC', name: 'beige'},
            {hex: '#FFE4C4', name: 'bisque'},
            {hex: '#FFE4C4', name: 'bisque1'},
            {hex: '#EED5B7', name: 'bisque2'},
            {hex: '#CDB79E', name: 'bisque3'},
            {hex: '#8B7D6B', name: 'bisque4'},
            {hex: '#000000', name: 'black'},
            {hex: '#FFEBCD', name: 'BlanchedAlmond'},
            {hex: '#0000FF', name: 'blue'},
            {hex: '#0000FF', name: 'blue1'},
            {hex: '#0000EE', name: 'blue2'},
            {hex: '#0000CD', name: 'blue3'},
            {hex: '#00008B', name: 'blue4'},
            {hex: '#8A2BE2', name: 'BlueViolet'},
            {hex: '#A52A2A', name: 'brown'},
            {hex: '#FF4040', name: 'brown1'},
            {hex: '#EE3B3B', name: 'brown2'},
            {hex: '#CD3333', name: 'brown3'},
            {hex: '#8B2323', name: 'brown4'},
            {hex: '#DEB887', name: 'burlywood'},
            {hex: '#FFD39B', name: 'burlywood1'},
            {hex: '#EEC591', name: 'burlywood2'},
            {hex: '#CDAA7D', name: 'burlywood3'},
            {hex: '#8B7355', name: 'burlywood4'},
            {hex: '#5F9EA0', name: 'CadetBlue'},
            {hex: '#98F5FF', name: 'CadetBlue1'},
            {hex: '#8EE5EE', name: 'CadetBlue2'},
            {hex: '#7AC5CD', name: 'CadetBlue3'},
            {hex: '#53868B', name: 'CadetBlue4'},
            {hex: '#7FFF00', name: 'chartreuse'},
            {hex: '#7FFF00', name: 'chartreuse1'},
            {hex: '#76EE00', name: 'chartreuse2'},
            {hex: '#66CD00', name: 'chartreuse3'},
            {hex: '#458B00', name: 'chartreuse4'},
            {hex: '#D2691E', name: 'chocolate'},
            {hex: '#FF7F24', name: 'chocolate1'},
            {hex: '#EE7621', name: 'chocolate2'},
            {hex: '#CD661D', name: 'chocolate3'},
            {hex: '#8B4513', name: 'chocolate4'},
            {hex: '#FF7F50', name: 'coral'},
            {hex: '#FF7256', name: 'coral1'},
            {hex: '#EE6A50', name: 'coral2'},
            {hex: '#CD5B45', name: 'coral3'},
            {hex: '#8B3E2F', name: 'coral4'},
            {hex: '#6495ED', name: 'CornflowerBlue'},
            {hex: '#FFF8DC', name: 'cornsilk'},
            {hex: '#FFF8DC', name: 'cornsilk1'},
            {hex: '#EEE8CD', name: 'cornsilk2'},
            {hex: '#CDC8B1', name: 'cornsilk3'},
            {hex: '#8B8878', name: 'cornsilk4'},
            {hex: '#DC143C', name: 'crymson'},
            {hex: '#00FFFF', name: 'cyan'},
            {hex: '#00FFFF', name: 'cyan1'},
            {hex: '#00EEEE', name: 'cyan2'},
            {hex: '#00CDCD', name: 'cyan3'},
            {hex: '#008B8B', name: 'cyan4'},
            {hex: '#00008B', name: 'DarkBlue'},
            {hex: '#008B8B', name: 'DarkCyan'},
            {hex: '#B8860B', name: 'DarkGoldenrod'},
            {hex: '#FFB90F', name: 'DarkGoldenrod1'},
            {hex: '#EEAD0E', name: 'DarkGoldenrod2'},
            {hex: '#CD950C', name: 'DarkGoldenrod3'},
            {hex: '#8B6508', name: 'DarkGoldenrod4'},
            {hex: '#A9A9A9', name: 'DarkGray'},
            {hex: '#006400', name: 'DarkGreen'},
            {hex: '#A9A9A9', name: 'DarkGrey'},
            {hex: '#BDB76B', name: 'DarkKhaki'},
            {hex: '#8B008B', name: 'DarkMagenta'},
            {hex: '#556B2F', name: 'DarkOliveGreen'},
            {hex: '#CAFF70', name: 'DarkOliveGreen1'},
            {hex: '#BCEE68', name: 'DarkOliveGreen2'},
            {hex: '#A2CD5A', name: 'DarkOliveGreen3'},
            {hex: '#6E8B3D', name: 'DarkOliveGreen4'},
            {hex: '#FF8C00', name: 'DarkOrange'},
            {hex: '#FF7F00', name: 'DarkOrange1'},
            {hex: '#EE7600', name: 'DarkOrange2'},
            {hex: '#CD6600', name: 'DarkOrange3'},
            {hex: '#8B4500', name: 'DarkOrange4'},
            {hex: '#9932CC', name: 'DarkOrchid'},
            {hex: '#BF3EFF', name: 'DarkOrchid1'},
            {hex: '#B23AEE', name: 'DarkOrchid2'},
            {hex: '#9A32CD', name: 'DarkOrchid3'},
            {hex: '#68228B', name: 'DarkOrchid4'},
            {hex: '#8B0000', name: 'DarkRed'},
            {hex: '#E9967A', name: 'DarkSalmon'},
            {hex: '#8FBC8F', name: 'DarkSeaGreen'},
            {hex: '#C1FFC1', name: 'DarkSeaGreen1'},
            {hex: '#B4EEB4', name: 'DarkSeaGreen2'},
            {hex: '#9BCD9B', name: 'DarkSeaGreen3'},
            {hex: '#698B69', name: 'DarkSeaGreen4'},
            {hex: '#483D8B', name: 'DarkSlateBlue'},
            {hex: '#2F4F4F', name: 'DarkSlateGray'},
            {hex: '#97FFFF', name: 'DarkSlateGray1'},
            {hex: '#8DEEEE', name: 'DarkSlateGray2'},
            {hex: '#79CDCD', name: 'DarkSlateGray3'},
            {hex: '#528B8B', name: 'DarkSlateGray4'},
            {hex: '#2F4F4F', name: 'DarkSlateGrey'},
            {hex: '#00CED1', name: 'DarkTurquoise'},
            {hex: '#9400D3', name: 'DarkViolet'},
            {hex: '#FF1493', name: 'DeepPink'},
            {hex: '#FF1493', name: 'DeepPink1'},
            {hex: '#EE1289', name: 'DeepPink2'},
            {hex: '#CD1076', name: 'DeepPink3'},
            {hex: '#8B0A50', name: 'DeepPink4'},
            {hex: '#00BFFF', name: 'DeepSkyBlue'},
            {hex: '#00BFFF', name: 'DeepSkyBlue1'},
            {hex: '#00B2EE', name: 'DeepSkyBlue2'},
            {hex: '#009ACD', name: 'DeepSkyBlue3'},
            {hex: '#00688B', name: 'DeepSkyBlue4'},
            {hex: '#696969', name: 'DimGray'},
            {hex: '#696969', name: 'DimGrey'},
            {hex: '#1E90FF', name: 'dodger blue'},
            {hex: '#1E90FF', name: 'DodgerBlue'},
            {hex: '#1E90FF', name: 'DodgerBlue1'},
            {hex: '#1C86EE', name: 'DodgerBlue2'},
            {hex: '#1874CD', name: 'DodgerBlue3'},
            {hex: '#104E8B', name: 'DodgerBlue4'},
            {hex: '#B22222', name: 'firebrick'},
            {hex: '#FF3030', name: 'firebrick1'},
            {hex: '#EE2C2C', name: 'firebrick2'},
            {hex: '#CD2626', name: 'firebrick3'},
            {hex: '#8B1A1A', name: 'firebrick4'},
            {hex: '#FFFAF0', name: 'FloralWhite'},
            {hex: '#228B22', name: 'forest green'},
            {hex: '#228B22', name: 'ForestGreen'},
            {hex: '#FF00FF', name: 'fuchsia'},
            {hex: '#DCDCDC', name: 'gainsboro'},
            {hex: '#F8F8FF', name: 'GhostWhite'},
            {hex: '#FFD700', name: 'gold'},
            {hex: '#FFD700', name: 'gold1'},
            {hex: '#EEC900', name: 'gold2'},
            {hex: '#CDAD00', name: 'gold3'},
            {hex: '#8B7500', name: 'gold4'},
            {hex: '#DAA520', name: 'goldenrod'},
            {hex: '#FFC125', name: 'goldenrod1'},
            {hex: '#EEB422', name: 'goldenrod2'},
            {hex: '#CD9B1D', name: 'goldenrod3'},
            {hex: '#8B6914', name: 'goldenrod4'},
            {hex: '#00FF00', name: 'green'},
            {hex: '#00FF00', name: 'green1'},
            {hex: '#00EE00', name: 'green2'},
            {hex: '#00CD00', name: 'green3'},
            {hex: '#008B00', name: 'green4'},
            {hex: '#ADFF2F', name: 'GreenYellow'},
            {hex: '#BEBEBE', name: 'grey'},
            {hex: '#000000', name: 'grey0'},
            {hex: '#030303', name: 'grey1'},
            {hex: '#050505', name: 'grey2'},
            {hex: '#080808', name: 'grey3'},
            {hex: '#0A0A0A', name: 'grey4'},
            {hex: '#0D0D0D', name: 'grey5'},
            {hex: '#0F0F0F', name: 'grey6'},
            {hex: '#121212', name: 'grey7'},
            {hex: '#141414', name: 'grey8'},
            {hex: '#171717', name: 'grey9'},
            {hex: '#1A1A1A', name: 'grey10'},
            {hex: '#1C1C1C', name: 'grey11'},
            {hex: '#1F1F1F', name: 'grey12'},
            {hex: '#212121', name: 'grey13'},
            {hex: '#242424', name: 'grey14'},
            {hex: '#262626', name: 'grey15'},
            {hex: '#292929', name: 'grey16'},
            {hex: '#2B2B2B', name: 'grey17'},
            {hex: '#2E2E2E', name: 'grey18'},
            {hex: '#303030', name: 'grey19'},
            {hex: '#333333', name: 'grey20'},
            {hex: '#363636', name: 'grey21'},
            {hex: '#383838', name: 'grey22'},
            {hex: '#3B3B3B', name: 'grey23'},
            {hex: '#3D3D3D', name: 'grey24'},
            {hex: '#404040', name: 'grey25'},
            {hex: '#424242', name: 'grey26'},
            {hex: '#454545', name: 'grey27'},
            {hex: '#474747', name: 'grey28'},
            {hex: '#4A4A4A', name: 'grey29'},
            {hex: '#4D4D4D', name: 'grey30'},
            {hex: '#4F4F4F', name: 'grey31'},
            {hex: '#525252', name: 'grey32'},
            {hex: '#545454', name: 'grey33'},
            {hex: '#575757', name: 'grey34'},
            {hex: '#595959', name: 'grey35'},
            {hex: '#5C5C5C', name: 'grey36'},
            {hex: '#5E5E5E', name: 'grey37'},
            {hex: '#616161', name: 'grey38'},
            {hex: '#636363', name: 'grey39'},
            {hex: '#666666', name: 'grey40'},
            {hex: '#696969', name: 'grey41'},
            {hex: '#6B6B6B', name: 'grey42'},
            {hex: '#6E6E6E', name: 'grey43'},
            {hex: '#707070', name: 'grey44'},
            {hex: '#737373', name: 'grey45'},
            {hex: '#757575', name: 'grey46'},
            {hex: '#787878', name: 'grey47'},
            {hex: '#7A7A7A', name: 'grey48'},
            {hex: '#7D7D7D', name: 'grey49'},
            {hex: '#7F7F7F', name: 'grey50'},
            {hex: '#828282', name: 'grey51'},
            {hex: '#858585', name: 'grey52'},
            {hex: '#878787', name: 'grey53'},
            {hex: '#8A8A8A', name: 'grey54'},
            {hex: '#8C8C8C', name: 'grey55'},
            {hex: '#8F8F8F', name: 'grey56'},
            {hex: '#919191', name: 'grey57'},
            {hex: '#949494', name: 'grey58'},
            {hex: '#969696', name: 'grey59'},
            {hex: '#999999', name: 'grey60'},
            {hex: '#9C9C9C', name: 'grey61'},
            {hex: '#9E9E9E', name: 'grey62'},
            {hex: '#A1A1A1', name: 'grey63'},
            {hex: '#A3A3A3', name: 'grey64'},
            {hex: '#A6A6A6', name: 'grey65'},
            {hex: '#A8A8A8', name: 'grey66'},
            {hex: '#ABABAB', name: 'grey67'},
            {hex: '#ADADAD', name: 'grey68'},
            {hex: '#B0B0B0', name: 'grey69'},
            {hex: '#B3B3B3', name: 'grey70'},
            {hex: '#B5B5B5', name: 'grey71'},
            {hex: '#B8B8B8', name: 'grey72'},
            {hex: '#BABABA', name: 'grey73'},
            {hex: '#BDBDBD', name: 'grey74'},
            {hex: '#BFBFBF', name: 'grey75'},
            {hex: '#C2C2C2', name: 'grey76'},
            {hex: '#C4C4C4', name: 'grey77'},
            {hex: '#C7C7C7', name: 'grey78'},
            {hex: '#C9C9C9', name: 'grey79'},
            {hex: '#CCCCCC', name: 'grey80'},
            {hex: '#CFCFCF', name: 'grey81'},
            {hex: '#D1D1D1', name: 'grey82'},
            {hex: '#D4D4D4', name: 'grey83'},
            {hex: '#D6D6D6', name: 'grey84'},
            {hex: '#D9D9D9', name: 'grey85'},
            {hex: '#DBDBDB', name: 'grey86'},
            {hex: '#DEDEDE', name: 'grey87'},
            {hex: '#E0E0E0', name: 'grey88'},
            {hex: '#E3E3E3', name: 'grey89'},
            {hex: '#E5E5E5', name: 'grey90'},
            {hex: '#E8E8E8', name: 'grey91'},
            {hex: '#EBEBEB', name: 'grey92'},
            {hex: '#EDEDED', name: 'grey93'},
            {hex: '#F0F0F0', name: 'grey94'},
            {hex: '#F2F2F2', name: 'grey95'},
            {hex: '#F5F5F5', name: 'grey96'},
            {hex: '#F7F7F7', name: 'grey97'},
            {hex: '#FAFAFA', name: 'grey98'},
            {hex: '#FCFCFC', name: 'grey99'},
            {hex: '#FFFFFF', name: 'grey100'},
            {hex: '#F0FFF0', name: 'honeydew'},
            {hex: '#F0FFF0', name: 'honeydew1'},
            {hex: '#E0EEE0', name: 'honeydew2'},
            {hex: '#C1CDC1', name: 'honeydew3'},
            {hex: '#838B83', name: 'honeydew4'},
            {hex: '#FF69B4', name: 'HotPink'},
            {hex: '#FF6EB4', name: 'HotPink1'},
            {hex: '#EE6AA7', name: 'HotPink2'},
            {hex: '#CD6090', name: 'HotPink3'},
            {hex: '#8B3A62', name: 'HotPink4'},
            {hex: '#CD5C5C', name: 'IndianRed'},
            {hex: '#FF6A6A', name: 'IndianRed1'},
            {hex: '#EE6363', name: 'IndianRed2'},
            {hex: '#CD5555', name: 'IndianRed3'},
            {hex: '#8B3A3A', name: 'IndianRed4'},
            {hex: '#4B0082', name: 'indigo'},
            {hex: '#FFFFF0', name: 'ivory'},
            {hex: '#FFFFF0', name: 'ivory1'},
            {hex: '#EEEEE0', name: 'ivory2'},
            {hex: '#CDCDC1', name: 'ivory3'},
            {hex: '#8B8B83', name: 'ivory4'},
            {hex: '#F0E68C', name: 'khaki'},
            {hex: '#FFF68F', name: 'khaki1'},
            {hex: '#EEE685', name: 'khaki2'},
            {hex: '#CDC673', name: 'khaki3'},
            {hex: '#8B864E', name: 'khaki4'},
            {hex: '#E6E6FA', name: 'lavender'},
            {hex: '#FFF0F5', name: 'LavenderBlush'},
            {hex: '#FFF0F5', name: 'LavenderBlush1'},
            {hex: '#EEE0E5', name: 'LavenderBlush2'},
            {hex: '#CDC1C5', name: 'LavenderBlush3'},
            {hex: '#8B8386', name: 'LavenderBlush4'},
            {hex: '#7CFC00', name: 'LawnGreen'},
            {hex: '#FFFACD', name: 'LemonChiffon'},
            {hex: '#FFFACD', name: 'LemonChiffon1'},
            {hex: '#EEE9BF', name: 'LemonChiffon2'},
            {hex: '#CDC9A5', name: 'LemonChiffon3'},
            {hex: '#8B8970', name: 'LemonChiffon4'},
            {hex: '#ADD8E6', name: 'LightBlue'},
            {hex: '#BFEFFF', name: 'LightBlue1'},
            {hex: '#B2DFEE', name: 'LightBlue2'},
            {hex: '#9AC0CD', name: 'LightBlue3'},
            {hex: '#68838B', name: 'LightBlue4'},
            {hex: '#F08080', name: 'LightCoral'},
            {hex: '#E0FFFF', name: 'LightCyan'},
            {hex: '#E0FFFF', name: 'LightCyan1'},
            {hex: '#D1EEEE', name: 'LightCyan2'},
            {hex: '#B4CDCD', name: 'LightCyan3'},
            {hex: '#7A8B8B', name: 'LightCyan4'},
            {hex: '#EEDD82', name: 'LightGoldenrod'},
            {hex: '#FFEC8B', name: 'LightGoldenrod1'},
            {hex: '#EEDC82', name: 'LightGoldenrod2'},
            {hex: '#CDBE70', name: 'LightGoldenrod3'},
            {hex: '#8B814C', name: 'LightGoldenrod4'},
            {hex: '#FAFAD2', name: 'LightGoldenrodYellow'},
            {hex: '#D3D3D3', name: 'LightGray'},
            {hex: '#90EE90', name: 'LightGreen'},
            {hex: '#D3D3D3', name: 'LightGrey'},
            {hex: '#FFB6C1', name: 'LightPink'},
            {hex: '#FFAEB9', name: 'LightPink1'},
            {hex: '#EEA2AD', name: 'LightPink2'},
            {hex: '#CD8C95', name: 'LightPink3'},
            {hex: '#8B5F65', name: 'LightPink4'},
            {hex: '#FFA07A', name: 'LightSalmon'},
            {hex: '#FFA07A', name: 'LightSalmon1'},
            {hex: '#EE9572', name: 'LightSalmon2'},
            {hex: '#CD8162', name: 'LightSalmon3'},
            {hex: '#8B5742', name: 'LightSalmon4'},
            {hex: '#20B2AA', name: 'LightSeaGreen'},
            {hex: '#87CEFA', name: 'LightSkyBlue'},
            {hex: '#B0E2FF', name: 'LightSkyBlue1'},
            {hex: '#A4D3EE', name: 'LightSkyBlue2'},
            {hex: '#8DB6CD', name: 'LightSkyBlue3'},
            {hex: '#607B8B', name: 'LightSkyBlue4'},
            {hex: '#8470FF', name: 'LightSlateBlue'},
            {hex: '#778899', name: 'LightSlateGray'},
            {hex: '#778899', name: 'LightSlateGrey'},
            {hex: '#B0C4DE', name: 'LightSteelBlue'},
            {hex: '#CAE1FF', name: 'LightSteelBlue1'},
            {hex: '#BCD2EE', name: 'LightSteelBlue2'},
            {hex: '#A2B5CD', name: 'LightSteelBlue3'},
            {hex: '#6E7B8B', name: 'LightSteelBlue4'},
            {hex: '#FFFFE0', name: 'LightYellow'},
            {hex: '#FFFFE0', name: 'LightYellow1'},
            {hex: '#EEEED1', name: 'LightYellow2'},
            {hex: '#CDCDB4', name: 'LightYellow3'},
            {hex: '#8B8B7A', name: 'LightYellow4'},
            {hex: '#00FF00', name: 'lime'},
            {hex: '#32CD32', name: 'LimeGreen'},
            {hex: '#FAF0E6', name: 'linen'},
            {hex: '#FF00FF', name: 'magenta'},
            {hex: '#FF00FF', name: 'magenta1'},
            {hex: '#EE00EE', name: 'magenta2'},
            {hex: '#CD00CD', name: 'magenta3'},
            {hex: '#8B008B', name: 'magenta4'},
            {hex: '#B03060', name: 'maroon'},
            {hex: '#FF34B3', name: 'maroon1'},
            {hex: '#EE30A7', name: 'maroon2'},
            {hex: '#CD2990', name: 'maroon3'},
            {hex: '#8B1C62', name: 'maroon4'},
            {hex: '#66CDAA', name: 'MediumAquamarine'},
            {hex: '#0000CD', name: 'MediumBlue'},
            {hex: '#BA55D3', name: 'MediumOrchid'},
            {hex: '#E066FF', name: 'MediumOrchid1'},
            {hex: '#D15FEE', name: 'MediumOrchid2'},
            {hex: '#B452CD', name: 'MediumOrchid3'},
            {hex: '#7A378B', name: 'MediumOrchid4'},
            {hex: '#9370DB', name: 'MediumPurple'},
            {hex: '#AB82FF', name: 'MediumPurple1'},
            {hex: '#9F79EE', name: 'MediumPurple2'},
            {hex: '#8968CD', name: 'MediumPurple3'},
            {hex: '#5D478B', name: 'MediumPurple4'},
            {hex: '#3CB371', name: 'MediumSeaGreen'},
            {hex: '#7B68EE', name: 'MediumSlateBlue'},
            {hex: '#00FA9A', name: 'MediumSpringGreen'},
            {hex: '#48D1CC', name: 'MediumTurquoise'},
            {hex: '#C71585', name: 'MediumVioletRed'},
            {hex: '#191970', name: 'midnight blue'},
            {hex: '#191970', name: 'MidnightBlue'},
            {hex: '#F5FFFA', name: 'MintCream'},
            {hex: '#FFE4E1', name: 'misty rose'},
            {hex: '#FFE4E1', name: 'MistyRose'},
            {hex: '#FFE4E1', name: 'MistyRose1'},
            {hex: '#EED5D2', name: 'MistyRose2'},
            {hex: '#CDB7B5', name: 'MistyRose3'},
            {hex: '#8B7D7B', name: 'MistyRose4'},
            {hex: '#FFE4B5', name: 'moccasin'},
            {hex: '#FFDEAD', name: 'NavajoWhite'},
            {hex: '#FFDEAD', name: 'NavajoWhite1'},
            {hex: '#EECFA1', name: 'NavajoWhite2'},
            {hex: '#CDB38B', name: 'NavajoWhite3'},
            {hex: '#8B795E', name: 'NavajoWhite4'},
            {hex: '#000080', name: 'navy'},
            {hex: '#000080', name: 'NavyBlue'},
            {hex: '#FDF5E6', name: 'OldLace'},
            {hex: '#808000', name: 'olive'},
            {hex: '#6B8E23', name: 'OliveDrab'},
            {hex: '#C0FF3E', name: 'OliveDrab1'},
            {hex: '#B3EE3A', name: 'OliveDrab2'},
            {hex: '#9ACD32', name: 'OliveDrab3'},
            {hex: '#698B22', name: 'OliveDrab4'},
            {hex: '#FFA500', name: 'orange'},
            {hex: '#FFA500', name: 'orange1'},
            {hex: '#EE9A00', name: 'orange2'},
            {hex: '#CD8500', name: 'orange3'},
            {hex: '#8B5A00', name: 'orange4'},
            {hex: '#FF4500', name: 'OrangeRed'},
            {hex: '#FF4500', name: 'OrangeRed1'},
            {hex: '#EE4000', name: 'OrangeRed2'},
            {hex: '#CD3700', name: 'OrangeRed3'},
            {hex: '#8B2500', name: 'OrangeRed4'},
            {hex: '#DA70D6', name: 'orchid'},
            {hex: '#FF83FA', name: 'orchid1'},
            {hex: '#EE7AE9', name: 'orchid2'},
            {hex: '#CD69C9', name: 'orchid3'},
            {hex: '#8B4789', name: 'orchid4'},
            {hex: '#EEE8AA', name: 'PaleGoldenrod'},
            {hex: '#98FB98', name: 'PaleGreen'},
            {hex: '#9AFF9A', name: 'PaleGreen1'},
            {hex: '#90EE90', name: 'PaleGreen2'},
            {hex: '#7CCD7C', name: 'PaleGreen3'},
            {hex: '#548B54', name: 'PaleGreen4'},
            {hex: '#AFEEEE', name: 'PaleTurquoise'},
            {hex: '#BBFFFF', name: 'PaleTurquoise1'},
            {hex: '#AEEEEE', name: 'PaleTurquoise2'},
            {hex: '#96CDCD', name: 'PaleTurquoise3'},
            {hex: '#668B8B', name: 'PaleTurquoise4'},
            {hex: '#DB7093', name: 'PaleVioletRed'},
            {hex: '#FF82AB', name: 'PaleVioletRed1'},
            {hex: '#EE799F', name: 'PaleVioletRed2'},
            {hex: '#CD687F', name: 'PaleVioletRed3'},
            {hex: '#8B475D', name: 'PaleVioletRed4'},
            {hex: '#FFEFD5', name: 'papaya whip'},
            {hex: '#FFEFD5', name: 'PapayaWhip'},
            {hex: '#FFDAB9', name: 'peach puff'},
            {hex: '#FFDAB9', name: 'PeachPuff'},
            {hex: '#FFDAB9', name: 'PeachPuff1'},
            {hex: '#EECBAD', name: 'PeachPuff2'},
            {hex: '#CDAF95', name: 'PeachPuff3'},
            {hex: '#8B7765', name: 'PeachPuff4'},
            {hex: '#CD853F', name: 'peru'},
            {hex: '#FFC0CB', name: 'pink'},
            {hex: '#FFB5C5', name: 'pink1'},
            {hex: '#EEA9B8', name: 'pink2'},
            {hex: '#CD919E', name: 'pink3'},
            {hex: '#8B636C', name: 'pink4'},
            {hex: '#DDA0DD', name: 'plum'},
            {hex: '#FFBBFF', name: 'plum1'},
            {hex: '#EEAEEE', name: 'plum2'},
            {hex: '#CD96CD', name: 'plum3'},
            {hex: '#8B668B', name: 'plum4'},
            {hex: '#B0E0E6', name: 'PowderBlue'},
            {hex: '#A020F0', name: 'purple'},
            {hex: '#9B30FF', name: 'purple1'},
            {hex: '#912CEE', name: 'purple2'},
            {hex: '#7D26CD', name: 'purple3'},
            {hex: '#551A8B', name: 'purple4'},
            {hex: '#FF0000', name: 'red'},
            {hex: '#FF0000', name: 'red1'},
            {hex: '#EE0000', name: 'red2'},
            {hex: '#CD0000', name: 'red3'},
            {hex: '#8B0000', name: 'red4'},
            {hex: '#BC8F8F', name: 'RosyBrown'},
            {hex: '#FFC1C1', name: 'RosyBrown1'},
            {hex: '#EEB4B4', name: 'RosyBrown2'},
            {hex: '#CD9B9B', name: 'RosyBrown3'},
            {hex: '#8B6969', name: 'RosyBrown4'},
            {hex: '#4169E1', name: 'RoyalBlue'},
            {hex: '#4876FF', name: 'RoyalBlue1'},
            {hex: '#436EEE', name: 'RoyalBlue2'},
            {hex: '#3A5FCD', name: 'RoyalBlue3'},
            {hex: '#27408B', name: 'RoyalBlue4'},
            {hex: '#8B4513', name: 'SaddleBrown'},
            {hex: '#FA8072', name: 'salmon'},
            {hex: '#FF8C69', name: 'salmon1'},
            {hex: '#EE8262', name: 'salmon2'},
            {hex: '#CD7054', name: 'salmon3'},
            {hex: '#8B4C39', name: 'salmon4'},
            {hex: '#F4A460', name: 'SandyBrown'},
            {hex: '#2E8B57', name: 'SeaGreen'},
            {hex: '#54FF9F', name: 'SeaGreen1'},
            {hex: '#4EEE94', name: 'SeaGreen2'},
            {hex: '#43CD80', name: 'SeaGreen3'},
            {hex: '#2E8B57', name: 'SeaGreen4'},
            {hex: '#FFF5EE', name: 'seashell'},
            {hex: '#FFF5EE', name: 'seashell1'},
            {hex: '#EEE5DE', name: 'seashell2'},
            {hex: '#CDC5BF', name: 'seashell3'},
            {hex: '#8B8682', name: 'seashell4'},
            {hex: '#A0522D', name: 'sienna'},
            {hex: '#FF8247', name: 'sienna1'},
            {hex: '#EE7942', name: 'sienna2'},
            {hex: '#CD6839', name: 'sienna3'},
            {hex: '#8B4726', name: 'sienna4'},
            {hex: '#C0C0C0', name: 'silver'},
            {hex: '#87CEEB', name: 'SkyBlue'},
            {hex: '#87CEFF', name: 'SkyBlue1'},
            {hex: '#7EC0EE', name: 'SkyBlue2'},
            {hex: '#6CA6CD', name: 'SkyBlue3'},
            {hex: '#4A708B', name: 'SkyBlue4'},
            {hex: '#6A5ACD', name: 'SlateBlue'},
            {hex: '#836FFF', name: 'SlateBlue1'},
            {hex: '#7A67EE', name: 'SlateBlue2'},
            {hex: '#6959CD', name: 'SlateBlue3'},
            {hex: '#473C8B', name: 'SlateBlue4'},
            {hex: '#708090', name: 'SlateGray'},
            {hex: '#C6E2FF', name: 'SlateGray1'},
            {hex: '#B9D3EE', name: 'SlateGray2'},
            {hex: '#9FB6CD', name: 'SlateGray3'},
            {hex: '#6C7B8B', name: 'SlateGray4'},
            {hex: '#708090', name: 'SlateGrey'},
            {hex: '#FFFAFA', name: 'snow'},
            {hex: '#FFFAFA', name: 'snow1'},
            {hex: '#EEE9E9', name: 'snow2'},
            {hex: '#CDC9C9', name: 'snow3'},
            {hex: '#8B8989', name: 'snow4'},
            {hex: '#00FF7F', name: 'SpringGreen'},
            {hex: '#00FF7F', name: 'SpringGreen1'},
            {hex: '#00EE76', name: 'SpringGreen2'},
            {hex: '#00CD66', name: 'SpringGreen3'},
            {hex: '#008B45', name: 'SpringGreen4'},
            {hex: '#4682B4', name: 'SteelBlue'},
            {hex: '#63B8FF', name: 'SteelBlue1'},
            {hex: '#5CACEE', name: 'SteelBlue2'},
            {hex: '#4F94CD', name: 'SteelBlue3'},
            {hex: '#36648B', name: 'SteelBlue4'},
            {hex: '#D2B48C', name: 'tan'},
            {hex: '#FFA54F', name: 'tan1'},
            {hex: '#EE9A49', name: 'tan2'},
            {hex: '#CD853F', name: 'tan3'},
            {hex: '#8B5A2B', name: 'tan4'},
            {hex: '#008080', name: 'teal'},
            {hex: '#D8BFD8', name: 'thistle'},
            {hex: '#FFE1FF', name: 'thistle1'},
            {hex: '#EED2EE', name: 'thistle2'},
            {hex: '#CDB5CD', name: 'thistle3'},
            {hex: '#8B7B8B', name: 'thistle4'},
            {hex: '#FF6347', name: 'tomato'},
            {hex: '#FF6347', name: 'tomato1'},
            {hex: '#EE5C42', name: 'tomato2'},
            {hex: '#CD4F39', name: 'tomato3'},
            {hex: '#8B3626', name: 'tomato4'},
            {hex: '#40E0D0', name: 'turquoise'},
            {hex: '#00F5FF', name: 'turquoise1'},
            {hex: '#00E5EE', name: 'turquoise2'},
            {hex: '#00C5CD', name: 'turquoise3'},
            {hex: '#00868B', name: 'turquoise4'},
            {hex: '#EE82EE', name: 'violet'},
            {hex: '#D02090', name: 'VioletRed'},
            {hex: '#FF3E96', name: 'VioletRed1'},
            {hex: '#EE3A8C', name: 'VioletRed2'},
            {hex: '#CD3278', name: 'VioletRed3'},
            {hex: '#8B2252', name: 'VioletRed4'},
            {hex: '#F5DEB3', name: 'wheat'},
            {hex: '#FFE7BA', name: 'wheat1'},
            {hex: '#EED8AE', name: 'wheat2'},
            {hex: '#CDBA96', name: 'wheat3'},
            {hex: '#8B7E66', name: 'wheat4'},
            {hex: '#FFFFFF', name: 'white'},
            {hex: '#F5F5F5', name: 'WhiteSmoke'},
            {hex: '#FFFF00', name: 'yellow'},
            {hex: '#9ACD32', name: 'yellow green'},
            {hex: '#FFFF00', name: 'yellow1'},
            {hex: '#EEEE00', name: 'yellow2'},
            {hex: '#CDCD00', name: 'yellow3'},
            {hex: '#8B8B00', name: 'yellow4'},
            {hex: '#9ACD32', name: 'YellowGreen'}
    
    0 讨论(0)
  • 2021-02-07 13:21

    some_widget(bg=some_widget._root().cget('bg'))

    0 讨论(0)
  • 2021-02-07 13:24

    I was trying to set a button's color to the system default. This is the best solution I've come across:

    root.configure(background='SystemButtonFace')
    

    Source: How to set default background colour tkinter

    0 讨论(0)
  • 2021-02-07 13:33

    rudivonstaden's answer led me to a solution to the problem, although for some reason root.cget("bg") fails because "bg" is an unknown color name.

    However, knowing that a widget has a dictionary containing its properties means that root["bg"] returns the background color of the widget.

    So if you create a window named myWindow without overriding your system's default background color, then myWindow["bg"] is the default background color for a window, which can be used when creating frameless text fields within that window.

    0 讨论(0)
  • 2021-02-07 13:38

    Not sure exactly what you're looking for, but will this work?

    import Tkinter
    
    mycolor = '#%02x%02x%02x' % (64, 204, 208)  # set your favourite rgb color
    mycolor2 = '#40E0D0'  # or use hex if you prefer 
    root = Tkinter.Tk()
    root.configure(bg=mycolor)
    Tkinter.Button(root, text="Press me!", bg=mycolor, fg='black',
                   activebackground='black', activeforeground=mycolor2).pack()
    root.mainloop()
    

    If you just want to find the current value of the window, and set widgets to use it, cget might be what you want:

    import Tkinter
    
    root = Tkinter.Tk()
    defaultbg = root.cget('bg')
    Tkinter.Button(root,text="Press me!", bg=defaultbg).pack()
    root.mainloop()
    

    If you want to set the default background color for new widgets, you can use the tk_setPalette(self, *args, **kw) method:

    root.tk_setPalette(background='#40E0D0', foreground='black',
                   activeBackground='black', activeForeground=mycolor2)
    Tkinter.Button(root, text="Press me!").pack()
    

    Then your widgets would have this background color by default, without having to set it in the widget parameters. There's a lot of useful information provided with the inline help functions import Tkinter; help(Tkinter.Tk)

    0 讨论(0)
提交回复
热议问题