Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All my programs show nothing on WIndows 11 (after connecting a second screen using an adapter) #8659

Open
SuperMechaDeathChrist opened this issue Mar 26, 2024 · 7 comments

Comments

@SuperMechaDeathChrist
Copy link

SuperMechaDeathChrist commented Mar 26, 2024

Software Versions

  • Python: 3.12.2 and 3.9.12
  • OS: Windows 11
  • Kivy: v2.3.0 and v2.1.0
  • Kivy installation method: pip, conda

Describe the bug
None of my programs are working. I have a lot of programs in my computer that i previously wrote and successfully ran using kivy, but none of them get to the point of opening the window to show it or starting the kivy main loop now.

This all happened overnight (i latter found out that this only happens when i use a second screen connected to an adapter), and it happens in two virtual environments created using anaconda. One is an old version kivy with an older python 3, and the other is the newest version of kivy (which worked during a few weeks) with a newer python 3. I can only asume something in a windows update or in my OS has broken compatibility with kivy, but i don't know how to search the bug as the logs show nothing. I can only track that after importing a few things in kivy, it just stops working and exits without doing anything or showing any errors.

Expected behavior
a normal log looks like this:

[INFO   ] Logger: Record log in C:\Users\migue\.kivy\logs\kivy_24-03-22_41.txt
[INFO   ] deps: Successfully imported "kivy_deps.gstreamer" 0.3.3
[INFO   ] deps: Successfully imported "kivy_deps.angle" 0.4.0
[INFO   ] deps: Successfully imported "kivy_deps.glew" 0.3.1
[INFO   ] deps: Successfully imported "kivy_deps.sdl2" 0.7.0
[INFO   ] Kivy: v2.3.0
[INFO   ] Kivy: Installed at "C:\ProgramData\Anaconda3\envs\simplekivy2\Lib\site-packages\kivy\__init__.py"
[INFO   ] Python: v3.12.2 | packaged by Anaconda, Inc. | (main, Feb 27 2024, 17:28:07) [MSC v.1916 64 bit (AMD64)]
[INFO   ] Python: Interpreter at "C:\ProgramData\Anaconda3\envs\simplekivy2\python.exe"
[INFO   ] Logger: Purge log fired. Processing...
[INFO   ] Logger: Purge finished!
[INFO   ] Factory: 195 symbols loaded
[INFO   ] Image: Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO   ] Text: Provider: sdl2
[INFO   ] Window: Provider: sdl2
[INFO   ] GL: Using the "OpenGL" graphics system
[INFO   ] GL: GLEW initialization succeeded
[INFO   ] GL: Backend used <glew>
[INFO   ] GL: OpenGL version <b'4.6.0 Compatibility Profile Context 22.20.44.221025'>
[INFO   ] GL: OpenGL vendor <b'ATI Technologies Inc.'>
[INFO   ] GL: OpenGL renderer <b'AMD Radeon(TM) Graphics'>
[INFO   ] GL: OpenGL parsed version: 4, 6
[INFO   ] GL: Shading version <b'4.60'>
[INFO   ] GL: Texture max size <16384>
[INFO   ] GL: Texture max units <32>
[INFO   ] Window: auto add sdl2 input provider
[INFO   ] Window: virtual keyboard not allowed, single mode, not docked
[INFO   ] Base: Start application main loop
[INFO   ] GL: NPOT texture support is available
[INFO   ] Base: Leaving application in progress...

Now all my logs show nothing after [INFO ] [Window ] Provider: sdl2

To Reproduce
The simplest kivy program doesn't work.

import kivy
# kivy.require('2.1.0') # replace with your current kivy version !
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
    def build(self):
        return Label(text='Hello world')
if __name__ == '__main__':
    MyApp().run()

My exact Windows version is:
Edition: Windows 11 Home
Version: 22H2
Installed on: ‎05/‎01/‎2023
OS build: 22621.3296
Experience: Windows Feature Experience Pack 1000.22687.1000.0

Code and Logs and screenshots

[INFO   ] [Logger      ] Record log in C:\Users\migue\.kivy\logs\kivy_24-03-26_32.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.gstreamer" 0.3.3
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.4.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.3.1
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.7.0
[INFO   ] [Kivy        ] v2.3.0
[INFO   ] [Kivy        ] Installed at "C:\ProgramData\Anaconda3\envs\simplekivy2\Lib\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.12.2 | packaged by Anaconda, Inc. | (main, Feb 27 2024, 17:28:07) [MSC v.1916 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "C:\ProgramData\Anaconda3\envs\simplekivy2\python.exe"
[INFO   ] [Logger      ] Purge log fired. Processing...
[INFO   ] [Logger      ] Purge finished!
{'trace': 9, 'debug': 10, 'info': 20, 'warning': 30, 'error': 40, 'critical': 50}
[DEBUG  ] [Cache       ] register <kv.resourcefind> with limit=None, timeout=60
[INFO   ] [Factory     ] 195 symbols loaded
[DEBUG  ] [Cache       ] register <kv.lang> with limit=None, timeout=None
[TRACE  ] [Lang        ] load file C:\ProgramData\Anaconda3\envs\simplekivy2\Lib\site-packages\kivy\data\style.kv, using utf8 encoding
[TRACE  ] [Parser      ] parsing 1340 lines
[TRACE  ] [Parser      ] got directive <kivy 1.0>
[TRACE  ] [Parser      ] got directive <import kivy kivy>
[TRACE  ] [Builder     ] build rule for <Label>
[TRACE  ] [Builder     ] build rule for <-Button,-ToggleButton>
[TRACE  ] [Builder     ] build rule for <BubbleContent>
[TRACE  ] [Builder     ] build rule for <BubbleButton>
[TRACE  ] [Builder     ] build rule for <Slider>
[TRACE  ] [Builder     ] build rule for <ProgressBar>
[TRACE  ] [Builder     ] build rule for <SplitterStrip>
[TRACE  ] [Builder     ] build rule for <Scatter>
[TRACE  ] [Builder     ] build rule for <RelativeLayout>
[TRACE  ] [Builder     ] build rule for <Image,AsyncImage>
[TRACE  ] [Builder     ] build rule for <EffectWidget>
[TRACE  ] [Builder     ] build rule for <TabbedPanelContent>
[TRACE  ] [Builder     ] build rule for <TabbedPanelStrip>
[TRACE  ] [Builder     ] build rule for <StripLayout>
[TRACE  ] [Builder     ] build rule for <TabbedPanelHeader>
[TRACE  ] [Builder     ] build rule for <Selector>
[TRACE  ] [Builder     ] build rule for <TextInput>
[TRACE  ] [Builder     ] build rule for <TextInputCutCopyPaste>
[TRACE  ] [Builder     ] build rule for <CodeInput>
[TRACE  ] [Builder     ] build rule for <TreeViewNode>
[TRACE  ] [Builder     ] build rule for <TreeViewLabel>
[TRACE  ] [Builder     ] build rule for <StencilView>
[TRACE  ] [Builder     ] build rule for <FileChooserListLayout>
[TRACE  ] [Builder     ] build rule for <FileChooserListView>
[TRACE  ] [Builder     ] build template for [FileListEntry@FloatLayout+TreeViewNode]
[TRACE  ] [Builder     ] build rule for <FileChooserIconLayout>
[TRACE  ] [Builder     ] build rule for <FileChooserIconView>
[TRACE  ] [Builder     ] build template for [FileIconEntry@Widget]
[TRACE  ] [Builder     ] build rule for <FileChooserProgress>
[TRACE  ] [Builder     ] build rule for <Switch>
[TRACE  ] [Builder     ] build rule for <ModalView>
[TRACE  ] [Builder     ] build rule for <Popup>
[TRACE  ] [Builder     ] build rule for <SpinnerOption>
[TRACE  ] [Builder     ] build rule for <Spinner>
[TRACE  ] [Builder     ] build rule for <ActionBar>
[TRACE  ] [Builder     ] build rule for <ActionView>
[TRACE  ] [Builder     ] build rule for <ActionSeparator>
[TRACE  ] [Builder     ] build rule for <ActionButton,ActionToggleButton>
[TRACE  ] [Builder     ] build rule for <ActionLabel>
[TRACE  ] [Builder     ] build rule for <ActionGroup>
[TRACE  ] [Builder     ] build rule for <ActionCheck>
[TRACE  ] [Builder     ] build rule for <ActionPreviousImage@Image>
[TRACE  ] [Builder     ] build rule for <ActionPreviousButton@Button>
[TRACE  ] [Builder     ] build rule for <ActionPrevious>
[TRACE  ] [Builder     ] build rule for <ActionGroup>
[TRACE  ] [Builder     ] build rule for <ActionOverflow>
[TRACE  ] [Builder     ] build rule for <ActionDropDown>
[TRACE  ] [Builder     ] build template for [AccordionItemTitle@Label]
[TRACE  ] [Builder     ] build rule for <AccordionItem>
[TRACE  ] [Builder     ] build rule for <SettingSpacer>
[TRACE  ] [Builder     ] build rule for <SettingItem>
[TRACE  ] [Builder     ] build rule for <SettingBoolean>
[TRACE  ] [Builder     ] build rule for <SettingString>
[TRACE  ] [Builder     ] build rule for <SettingPath>
[TRACE  ] [Builder     ] build rule for <SettingColor>
[TRACE  ] [Builder     ] build rule for <SettingOptions>
[TRACE  ] [Builder     ] build rule for <SettingTitle>
[TRACE  ] [Builder     ] build rule for <SettingSidebarLabel>
[TRACE  ] [Builder     ] build rule for <SettingsPanel>
[TRACE  ] [Builder     ] build rule for <Settings>
[TRACE  ] [Builder     ] build rule for <InterfaceWithSidebar>
[TRACE  ] [Builder     ] build rule for <InterfaceWithSpinner>
[TRACE  ] [Builder     ] build rule for <MenuSpinner>
[TRACE  ] [Builder     ] build rule for <MenuSidebar>
[TRACE  ] [Builder     ] build rule for <ContentPanel>
[TRACE  ] [Builder     ] build rule for <InterfaceWithTabbedPanel>
[TRACE  ] [Builder     ] build rule for <ScrollView>
[TRACE  ] [Builder     ] build rule for <VideoPlayerPreview>
[TRACE  ] [Builder     ] build rule for <VideoPlayerAnnotation>
[TRACE  ] [Builder     ] build rule for <VideoPlayer>
[TRACE  ] [Builder     ] build rule for <CheckBox>
[TRACE  ] [Builder     ] build rule for <ScreenManager>
[TRACE  ] [Builder     ] build rule for <ColorPicker_Input@TextInput>
[TRACE  ] [Builder     ] build rule for <ColorPicker_Label@Label>
[TRACE  ] [Builder     ] build rule for <ColorPicker_Selector@BoxLayout>
[TRACE  ] [Builder     ] build rule for <ColorWheel>
[TRACE  ] [Builder     ] build rule for <ColorPicker>
[DEBUG  ] [Cache       ] register <kv.image> with limit=None, timeout=60
[DEBUG  ] [Cache       ] register <kv.atlas> with limit=None, timeout=None
[INFO   ] [ImageLoaderFFPy] Using ffpyplayer 4.5.1
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_ffpyplayer 
[DEBUG  ] [Cache       ] register <kv.texture> with limit=1000, timeout=60
[DEBUG  ] [Cache       ] register <kv.shader> with limit=1000, timeout=3600
[DEBUG  ] [Cache       ] register <kv.graphics.texture> with limit=None, timeout=None
[TRACE  ] [Parser      ] parsing 19 lines
[TRACE  ] [Builder     ] build rule for <-CoverBehavior>
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
[Finished in 4.1s]

Additional context
Any ideas regarding how to track or solve the problem are appreciated. I tried elevating the debug level to show as much as possible, but i can't find what is wrong. I'll try to use another window provider besides sdl2, as it seems to be the more likely suspect.

@SuperMechaDeathChrist
Copy link
Author

SuperMechaDeathChrist commented Mar 27, 2024

I found that this only happens when i connect a second screen to my laptop. The behavior is the same as described in the issue. The second screen is connected using a generic usb to hdmi/vga adapter, not sure if that matters. Disconnecting the screen "solves" the issue, but it is a shame that i can't work using my two screens, so my question still stands. How can i track or work around it? I still don't remember this happening before, but I'm not 100% sure, as i don't often work with two screens connected to my laptop.

@SuperMechaDeathChrist SuperMechaDeathChrist changed the title All my programs show nothing on WIndows 11 overnight All my programs show nothing on WIndows 11 (after connecting a second screen using an adapter) Mar 27, 2024
@ikus060
Copy link
Contributor

ikus060 commented Apr 2, 2024

Can you try using a different backend ?

Put KIVY_GL_BACKEND=angle_sdl2 in your variable environment

@SuperMechaDeathChrist
Copy link
Author

Can you try using a different backend ?

Put KIVY_GL_BACKEND=angle_sdl2 in your variable environment

I tried setting up the environment variable KIVY_GL_BACKEND=angle_sdl2 but the problem persists. This is the log when the video adapter is connected:

[INFO   ] [Logger      ] Record log in C:\Users\migue\.kivy\logs\kivy_24-04-05_21.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.gstreamer" 0.3.3
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.4.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.3.1
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.7.0
[INFO   ] [Kivy        ] v2.3.0
[INFO   ] [Kivy        ] Installed at "C:\ProgramData\Anaconda3\envs\simplekivy2\Lib\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.12.2 | packaged by Anaconda, Inc. | (main, Feb 27 2024, 17:28:07) [MSC v.1916 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "C:\ProgramData\Anaconda3\envs\simplekivy2\python.exe"
[INFO   ] [Logger      ] Purge log fired. Processing...
[INFO   ] [Logger      ] Purge finished!
[INFO   ] [Factory     ] 195 symbols loaded
[INFO   ] [ImageLoaderFFPy] Using ffpyplayer 4.5.1
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_ffpyplayer 
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [Window      ] Activate GLES2/ANGLE context

And this is when the video adapter is not connected (the window is created successfully):

[INFO   ] [Logger      ] Record log in C:\Users\migue\.kivy\logs\kivy_24-04-05_24.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.gstreamer" 0.3.3
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.4.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.3.1
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.7.0
[INFO   ] [Kivy        ] v2.3.0
[INFO   ] [Kivy        ] Installed at "C:\ProgramData\Anaconda3\envs\simplekivy2\Lib\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.12.2 | packaged by Anaconda, Inc. | (main, Feb 27 2024, 17:28:07) [MSC v.1916 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "C:\ProgramData\Anaconda3\envs\simplekivy2\python.exe"
[INFO   ] [Logger      ] Purge log fired. Processing...
[INFO   ] [Logger      ] Purge finished!
[INFO   ] [Factory     ] 195 symbols loaded
[INFO   ] [ImageLoaderFFPy] Using ffpyplayer 4.5.1
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_ffpyplayer 
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [Window      ] Activate GLES2/ANGLE context
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] Backend used <angle_sdl2>
[INFO   ] [GL          ] OpenGL version <b'OpenGL ES 2.0.0 OGLP-221025 '>
[INFO   ] [GL          ] OpenGL vendor <b'ATI Technologies Inc.'>
[INFO   ] [GL          ] OpenGL renderer <b'AMD Radeon(TM) Graphics'>
[INFO   ] [GL          ] OpenGL parsed version: 2, 0
[INFO   ] [GL          ] Shading version <b'OpenGL ES GLSL ES 3.20'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <32>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [Base        ] Start application main loop
[INFO   ] [GL          ] NPOT texture support is available

@SuperMechaDeathChrist
Copy link
Author

I found a workaround, which is terrible and annoying, but it does the trick.
I literally have to set my display settings in windows to show only the main display before importing kivy, and setting the option back to extend the displays after the window is successfully created inside my kivy program. This is done in windows with the command line commands DISPLAYSWITCH.exe /internal and DISPLAYSWITCH.exe /clone that i send using os.system (take note that these commands are for 2 screens only).

This is not a solution and, as a sidenote, the kivy programs also fail in the way i described above even if the main screen is mirrored, as long as the usb video adapter is connected.

@SuperMechaDeathChrist
Copy link
Author

I still don't know the cause, but i now have determined when it happens. For some reason, if i set the display settings of my computer to internal, then i initialize a kivy widget (any widget, it does not matter), then i set display settings to extend again, i can create a kivy program after that even if the usb video adapter is connected. Whatever the problem is, it happens when the first widget is initialized, after that, creating a window is possible. However, the steps of showing in only one display, initializing a widget, then extending displays is not what i want.

The code that shows what i describe is:

import os
from kivy.uix.label import Label
os.system('DISPLAYSWITCH.exe /internal')
Label()
os.system('DISPLAYSWITCH.exe /extend')

import kivy
# kivy.require('2.1.0') # replace with your current kivy version !
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
    def build(self):
        return Label(text='Hello world')
if __name__ == '__main__':
    MyApp().run()

Doing this before creating any kivy app window, i can successfully run my programs that i had before, but it is annoying watching my monitors flicker before running any kivy program.

@SuperMechaDeathChrist
Copy link
Author

I have come to the conclusion that this problem is to niche.

I found a "less annoying" solution. Whatever the problem is, it is related to the internal display and maybe the graphics card of my laptop. When I close the lid, the laptop's internal window doesn't appear in the display settings of windows, as if it were physically removed. That leaves me with the monitor i connect via hdmi, and the monitor connected with the video adapter. Here is when the problems i described above happen, as it is my working setup at home.

Having the laptop lid open (even if i turn that screen off) just didn't make sense as my normal working conditions, but there you have it. THIS is the less annoying solution. Having the laptop lid slightly open, just so that windows detects the internal display, makes my kivy programs run normally (i suspect there is an internal switch, and windows not detecting the internal display of my laptop breaks all functionality with kivy apparently, unless i do the "fix" of my previous comment.)

So, i'll just keep the lid of my laptop slightly open forever, or until someone finds any real solution.

@misl6
Copy link
Member

misl6 commented Apr 6, 2024

@SuperMechaDeathChrist , please keep an eye on #8665, and let us know if the issue persists even after the linked issue has been closed, so we can move forward with an investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants