问题
When I set the window title, the title is set back to it's corresponding file name.
class myniceApp(App):
global Window
def build(self):
Window.clearcolor = (.95,.95,.95,1)
Window.size = (1024, 768)
Window.set_title('mykivyapp')
Builder.load_string(style)
homewin = MyniceappHome()
homewin.initapp()
return homewin
myniceApp().run()
In the above example, the title 'mykivyapp' is shown initially but set back to the filename after homewin.initapp()
How should set_title() be used?
回答1:
Window title is set with App.title, not with Window directly:
class MyApp(App):
def build(self):
self.title = 'Hello world'
回答2:
you can use it like below.. this one worked for me.. i tried the first solution explained above, but it did not work.. so i change a bit and put the title outside the build function, its working successfully..
class controllerApp(App):
title = 'Vehicle Detection System'
def build(self, video_source=VIDEO_SOURCE):
...
...
来源:https://stackoverflow.com/questions/41848436/kivy-window-set-title-changes-back-to-main-file-name