Removing Drag and Drop formatting of drop area in Python/GTK3



When implementing drag and drop in Python and GTK3 the default
behaviour is that if I drag something towards the drop area, then the
drop area obtains a rectangular black frame. How to remove this
effect?

As per gtk3 docs, there is a style class GTK-STYLE-CLASS-DND 'dnd', so
I would think that adding

----
style_provider = Gtk.CssProvider()
css="""
.dnd {
      border-width=0px;
}"""
style_provider.load_from_data(bytes(css.encode()))

Gtk.StyleContext.add_provider_for_screen(
    Gdk.Screen.get_default(),
    style_provider,
    Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION )
----

or similar to the program should do the trick. But I had no luck with
it. I kept changing other properties within the .dnd block to see if
it has any effect at all but it doesn't (otherwise CSS works fine,
e.g. if I change .dnd to :hover then the effect is as expected).

Best, Lukasz

P.S. Just in case I'm using a wrong tool: I'm trying to implement
selecting several widgets ("calendar cells") in a Gtk.Grid via draging
the mouse across them, similar to google calendar. I'd like to have
the same formatting of all cells which are being selected (which is
why I don't want any special dnd formatting on the last cell)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]