Python Forum
[Kivy] Windows 10: AttributeError: 'WM_PenProvider' object has no attribute 'hwnd'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Kivy] Windows 10: AttributeError: 'WM_PenProvider' object has no attribute 'hwnd'
#1
Hello, when I execute my kivy program I get the following error message:
Quote:AttributeError: 'WM_PenProvider' object has no attribute 'hwnd'

Small description on how my app works.
My app starts with a login screen which works properly. After I have logged in, my app crashes with the above error message. At first, as usual the build method gets executed after running the run method of my custom app class (i.e. CustomClass().run()). As you can see below I have created two classes LoginScreen and MainScreen which handle different kind of things like displaying a table, statistics etc. Each of these screens are determined by the screen_to_load variable. Every time I switch from one kv file to the other, first I unload the previous one and then load the next one. To switch to the next screen I am executing in the login and logout methods accordingly self.__app.run(), which works on Ubuntu 20.04. LTS but not on my Windows 10 system (as depicted with #---->). I am not quite sure if this methodology is the right one, because by running again the run method of the app it is like initializing the application from the beginning. I have searched for this problem via google, but only 2-4 results where found, which didn't help me. I hope you guys can help me out, because I'm struggling with this issue a week. The wired thing is that on Ubuntu it works properly but on Windows (this is the OS I need to run the app) it doesn't work.

Build method in kivy_app.py
def build(self):
        screen = None

        # Loads the login screen
        if self.screen_to_load == 'login':
            self.theme_cls.theme_style = "Light"
            self.theme_cls.primary_palette = "Indigo"
            
            Builder.unload_file("kv/main_screen.kv")
            Builder.load_file("kv/login_screen.kv")
            screen = LoginScreen(self)

        # Loads the main screen
        elif self.screen_to_load == 'main':            
            # Loads the main screen
            self.theme_cls.primary_palette = "BlueGray"
            Builder.unload_file("kv/login_screen.kv")
            Builder.load_file("kv/main_screen.kv")
            
            self.use_kivy_settings = False
            self.settings_cls = SettingsWithSidebar
            screen = MainScreen(self)
            
        return screen
login_screen.py
class LoginScreen(Screen):
    ...
    def login(self):
        if self.ids.user.text == "user" and self.ids.password.text == "pass":
            self.__app.screen_to_load = 'main'
            self.__app.run() #----> When executing this line, the crash occurs
    ...
main_screen.py
class MainScreen(Screen):
    ...         
    def logout(self):
        self.hide_widgets()
        self.__app.screen_to_load = 'login'
        self.__app.run()
    ...
Reply
#2
More error trace would be helpful. Also helpful is making a small example that demonstrates the problem. A small peek into the code with no roadmap for the error is not going to get an replies.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  'NoneType' object has no attribute 'get' zunebuggy 8 1,366 Oct-13-2023, 06:39 PM
Last Post: zunebuggy
  tkinter AttributeError: 'GUI' object has no attribute pfdjhfuys 3 1,549 May-18-2023, 03:30 PM
Last Post: pfdjhfuys
  [Tkinter] Can't update label in new tk window, object has no attribute tompranks 3 3,547 Aug-30-2022, 08:44 AM
Last Post: tompranks
  AttributeError: 'NoneType' object has no attribute 'get' George87 5 15,430 Dec-23-2021, 04:47 AM
Last Post: George87
  [PyQt] AttributeError: 'NoneType' object has no attribute 'text' speedev 9 11,409 Sep-25-2021, 06:14 PM
Last Post: Axel_Erfurt
  [Tkinter] AttributeError: '' object has no attribute 'tk' Maryan 2 14,632 Oct-29-2020, 11:57 PM
Last Post: Maryan
  [Tkinter] AttributeError: 'tuple' object has no attribute 'replace' linuxhacker 7 6,864 Aug-08-2020, 12:47 AM
Last Post: linuxhacker
  [Kivy] AttributeError: 'NoneType' object has no attribute 'bind' faszination_92 2 6,267 Apr-12-2020, 07:01 PM
Last Post: Larz60+
  AttributeError: '_tkinter.tkapp' object has no attribute 'place_forget' edphilpot 5 9,183 Dec-20-2019, 09:52 PM
Last Post: joe_momma
  [Tkinter] AttributeError: 'App' object has no attribute 'set_text' Sahil1313 6 12,066 Jun-17-2018, 05:01 AM
Last Post: woooee

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020