Pygtk color for drag highlight

0 votes
What should I do if I want to change the highlight color for a gtk.EventBox. It has a certain background color, and I want to draw a line around it with its complementary color. I have found drag_highlight, which draws a line around the widget, but I have not figured out how to change the color: it's always black. Can anyone help me with it?
Mar 7, 2019 in Python by ana1504.k
• 7,910 points

1 answer to this question.

0 votes
To make the line around the EventBox, it is possible to put it into the Frame or another EventBox. You can try the following code:

#!/usr/bin/env python

# example

import pygtk
import gtk

class EventBoxExample:
    def __init__(self):
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.set_title("Event Box")
        window.connect("destroy", lambda w: gtk.main_quit())

        # Create an EventBox and add it to our toplevel window
        frame = gtk.EventBox() # gtk.Frame()

        event_box = gtk.EventBox()

        # Create a long label
        label = gtk.Label("Click here to quit, quit, quit, quit, quit")

        # Clip it short.
        label.set_size_request(110, 20)

        # And bind an action to it
        event_box.connect("button_press_event", lambda w,e: gtk.main_quit())

        # More things you need an X window for ...

        # Set background color to green

def main():
    return 0

if __name__ == "__main__":
answered Mar 7, 2019 by SDeb
• 13,300 points

Related Questions In Python

+2 votes
2 answers

How to use BeatifulSoup for webscraping?

your programme is fine until you start ...READ MORE

answered Apr 4, 2018 in Python by charlie_brown
• 7,780 points
0 votes
1 answer

Unique identification for data items in Python

Try the UUID module of Python. For example, ...READ MORE

answered Apr 17, 2018 in Python by Nietzsche's daemon
• 4,260 points
0 votes
1 answer

How can I reformat value_counts() analysis in Pandas for large number of columns?

If I were you, I'd do it ...READ MORE

answered Apr 17, 2018 in Python by anonymous
0 votes
3 answers

Python Selenium best tutorials for beginners

Hope this will help you...Python Tutorial READ MORE

answered Feb 11, 2019 in Python by aldrinjohn
• 140 points
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,481 views
0 votes
1 answer
0 votes
1 answer

Return a list inside a for loop while iterating over the elements of another list

The print() is getting called multiple times ...READ MORE

answered Sep 22, 2018 in Python by SDeb
• 13,300 points
0 votes
1 answer

Iterating over dictionaries using 'for' loops

key is just a variable name. for key ...READ MORE

answered Oct 8, 2018 in Python by SDeb
• 13,300 points