getcolors_gtk2.py 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #!/usr/bin/env python2.7
  2. # -*- coding: utf-8 -*-
  3. # thanks to this:
  4. # bytes.com/topic/python/answers/748007-pygtk-theme-colors
  5. #~ import pygtk
  6. #~ pygtk.require('2.0')
  7. import gtk
  8. #~ import sys
  9. #~ print 'Number of arguments:', len(sys.argv), 'arguments.'
  10. #~ print 'Argument List:', str(sys.argv[1])
  11. w = gtk.Window()
  12. w.realize()
  13. style=w.get_style()
  14. #~ for attr in w.get_style():
  15. #~ print attr
  16. sep="============================================"
  17. print '''A style contains the graphics information needed by a widget to draw itself in its various states:
  18. STATE_NORMAL # The state during normal operation.
  19. STATE_ACTIVE # The widget is currently active, such as a button pushed
  20. STATE_PRELIGHT # The mouse pointer is over the widget.
  21. STATE_SELECTED # The widget is selected
  22. STATE_INSENSITIVE # The widget is disabled
  23. A style contains the following attributes:
  24. '''
  25. l=[gtk.STATE_NORMAL,gtk.STATE_ACTIVE,gtk.STATE_PRELIGHT,gtk.STATE_SELECTED,gtk.STATE_INSENSITIVE]
  26. #~ see http://www.pygtk.org/pygtk2tutorial/sec-WidgetStyles.html for a full list
  27. print sep,"\nbase - a list of 5 colors"
  28. for i in l:
  29. print "\t",style.base[i].to_string(),i
  30. print sep,"\ntext - a list of 5 colors"
  31. for i in l:
  32. print "\t",style.text[i].to_string(),i
  33. print sep,"\nfg - a list of 5 foreground colors - one for each state"
  34. for i in l:
  35. print "\t",style.fg[i].to_string(),i
  36. print sep,"\nbg - a list of 5 background colors"
  37. for i in l:
  38. print "\t",style.bg[i].to_string(),i
  39. print sep,"\nlight - a list of 5 colors - created during set_style() method"
  40. for i in l:
  41. print "\t",style.light[i].to_string(),i
  42. print sep,"\ndark - a list of 5 colors - created during set_style() method"
  43. for i in l:
  44. print "\t",style.dark[i].to_string(),i
  45. print sep,"\nmid - a list of 5 colors - created during set_style() method"
  46. for i in l:
  47. print "\t",style.mid[i].to_string(),i
  48. print sep,"\ntext_aa - a list of 5 colors halfway between text/base"
  49. for i in l:
  50. print "\t",style.text_aa[i].to_string(),i
  51. #~ print "============================================"
  52. #~ for i in l:
  53. #~ print "BG \t:: black\t:: ",style.black[i].to_string(),i
  54. #~ print "============================================"
  55. #~ for i in l:
  56. #~ print "BG \t:: white\t:: ",style.white[i].to_string(),i
  57. #~ print "============================================"
  58. #~ for i in l:
  59. #~ print "BG \t:: font_desc\t:: ",style.font_desc[i].to_string(),i
  60. #~ print "============================================"
  61. #~ for i in l:
  62. #~ print "BG \t:: xthickness\t:: ",style.xthickness[i].to_string(),i
  63. #~ print "============================================"
  64. #~ for i in l:
  65. #~ print "BG \t:: fg_gc\t:: ",style.fg_gc[i].to_string(),i
  66. #~ print "============================================"
  67. #~ for i in l:
  68. #~ print "BG \t:: bg_gc\t:: ",style.bg_gc[i].to_string(),i
  69. #~ print "============================================"
  70. #~ for i in l:
  71. #~ print "BG \t:: light_gc\t:: ",style.light_gc[i].to_string(),i
  72. #~ print "============================================"
  73. #~ for i in l:
  74. #~ print "BG \t:: dark_gc\t:: ",style.dark_gc[i].to_string(),i
  75. #~ print "============================================"
  76. #~ for i in l:
  77. #~ print "BG \t:: mid_gc\t:: ",style.mid_gc[i].to_string(),i
  78. #~ print "============================================"
  79. #~ for i in l:
  80. #~ print "BG \t:: text_gc\t:: ",style.text_gc[i].to_string(),i
  81. #~ print "============================================"
  82. #~ for i in l:
  83. #~ print "BG \t:: base_gc\t:: ",style.base_gc[i].to_string(),i
  84. #~ print "============================================"
  85. #~ for i in l:
  86. #~ print "BG \t:: black_gc\t:: ",style.black_gc[i].to_string(),i
  87. #~ print "============================================"
  88. #~ for i in l:
  89. #~ print "BG \t:: white_gc\t:: ",style.white_gc[i].to_string(),i
  90. #~ print "============================================"
  91. #~ for i in l:
  92. #~ print "BG \t:: bg_pixmap\t:: ",style.bg_pixmap[i].to_string(),i
  93. #~ for i in l:
  94. #~ print "BASE\t::\t:: ",style.base[i]
  95. #~ for i in l:
  96. #~ print "- text",i,"\t:: ",style.text[i]
  97. #~ for i in l:
  98. #~ print "FG \t::\t:: ",style.fg[i]
  99. #~ for i in l:
  100. #~ print "BG \t::\t:: ",style.bg[i]
  101. #~ if sys.argv[1] == 'fg':
  102. #~ print "\t",style.fg[gtk.STATE_NORMAL]
  103. #~ if sys.argv[1] == 'bg':
  104. #~ print "\t",style.bg[gtk.STATE_NORMAL]
  105. #~ print "\t",style.fg[gtk.STATE_NORMAL].to_string(),i
  106. #~ print "\t",style.bg[gtk.STATE_NORMAL].to_string(),i
  107. #~ print "\t",style.bg[gtk.STATE_SELECTED]
  108. #~ print "\t",style.fg[gtk.STATE_NORMAL].to_string(),i
  109. #~ print "\t",style.bg[gtk.STATE_NORMAL].to_string(),i