Staying down toolbar buttons

Hello,

I am trying to use a button in a toolbar that is pressed in by default. Unfortunately it seems, that if it is initially in this state (no matter if I set it with SetOn, SetDown or Toggle), one requires double click at first to switch it to other state. First click does not seem to edit signal. Here is how I initialize it:

		self.Toolbar = ROOT.TGToolBar(self.MainFrame, width, 80)
		self.tbPhysical = ROOT.TGPictureButton(self.Toolbar, "~/icons/p.xpm", widgetsIds.tbPhysical)
		self.Toolbar.AddButton(self.MainFrame, self.tbPhysical, 1)
		self.tbPhysical.Connect("Clicked()", "TPyDispatcher", self.toolbar_dispatch, "Dispatch()")
		self.tbPhysical.AllowStayDown(True)		
		self.tbPhysical.SetDown()		

And the second question is: can I make my pyROOT app look for xpm icons in it’s own, relative path?

Hi,

this is way beyond my expertise … I’ll ask Bertrand, but these are in a better place on the ROOT support forum.

Cheers,
Wim

Hi,

Replace self.tbPhysical.SetDown() by self.tbPhysical.SetState(kButtonEngaged)

[quote=“LeWhoo”]And the second question is: can I make my pyROOT app look for xpm icons in it’s own, relative path?[/quote]This is not a problem with standard standalone (C++) ROOT application. So it should be just fine with Python…

Cheers, Bertrand.

[quote=“bellenot”]Hi,

Replace self.tbPhysical.SetDown() by self.tbPhysical.SetState(kButtonEngaged)
[/quote]

Works, thx!

So how should I address it? It is in the directory icons of my main python file. “icons/a.xpm” or “./icons/a.xpm” do not work…

No idea, it works for me in C++ with relative and absolute paths… You can maybe try to use something like “gSystem->DirName(gInterpreter->GetCurrentMacroName())” to obtain full path in C++. Maybe something like “path.dirname(file)” in Python?