wx.ActivityIndicator set color?

I have a example of wx.ActivityIndicator. I try to set color for an animation indicating,but Whether I set foreground or backgroundcolor, it doesn’t work。What is it going to do?

      class MyFrame10(wx.Frame):
	   def __init__(self):		
		wx.Frame.__init__(self,None,-1,'ty',size=(600,300))
		self.pn1=wx.Panel(self)
		pn2=wx.Panel(self)
		pn2.SetBackgroundColour('red')
		self.pn1.SetBackgroundColour('light blue')

		self.btn=wx.Button(self.pn1,-1,'press')
		vbox = wx.BoxSizer(wx.VERTICAL)
		vbox.Add(self.pn1, flag=wx.ALL|wx.EXPAND,proportion=1)
		vbox.Add(pn2,flag=wx.ALL|wx.EXPAND,proportion=2)
		self.SetSizer(vbox)		
		self.ac=None		
		
		self.Bind(wx.EVT_BUTTON,self.active,self.btn)

	  def active(self,e):		
		   if not self.ac:		
			self.ac = wx.ActivityIndicator()
			self.ac.Create(self.pn1,pos=(150,30),size=(50,50))	
			self.ac.Start()			
			self.ac.SetOwnForegroundColour('yellow')
			self.ac.SetScrollbar(100, 60, 50, 15)
			print(self.ac.UseForegroundColour())	
			
		else:
			print('a.colBg')
			self.ac.Stop()
			self.ac.Destroy()
			self.ac=None			

      class myapp(wx.App):	
	   def OnInit(self):				
		frame = MyFrame10()	
		frame.Show()		
		return True

    if __name__ == '__main__':
	app = myapp()	
	app.MainLoop()

What platform are you on?

When I run your code on Python 3.8.10 + wxPython 4.1.1 gtk3 (phoenix) wxWidgets 3.1.5 + Linux Mint 20.3, the activity indicator is displayed in yellow.

Screenshot at 2022-04-26 08-39-19

The only error I get is for the self.ac.SetScrollbar() call:

wx._core.wxAssertionError: C++ assertion ""sb"" failed at /home/wxpy/wxPython-4.1.1/ext/wxWidgets/src/gtk/window.cpp(6030) in SetScrollbar(): this window is not scrollable

If I comment out that line, then print(self.ac.UseForegroundColour()) outputs "True".

my platform is Python 3.8.2 + wxPython 4.1.1 +windows10. I run it as following:


I set it yellow why it is black ? And what is going to do?

Can anyone help me ?

As @RichardT showed, the build version on gtk3 seems to support the foreground colour, but I don’t think the one on msw implements it (I didn’t check the source).

Correct. The generic implementation is used on MSW (GTK and OSX have a native widget) and it just uses black instead of the foreground color. It would be an easy change though if anybody is interested in submitting a PR to wxWidgets.

See: