Kivy window set_title changes back to main file name

不羁岁月 提交于 2020-01-22 03:02:16

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!