wxPython - Screen resolution 3000x2000 and DPI on 200% problem - python

I wrote an Tool with a wxPython GUI. On Full HD and less everything runs fine. A friend of mine tested a bit with my tool and he uses a Microsoft Surface Book laptop with a screen resolution of 3000x2000 and DPI set to 200% on Windows 10.
And he has the problem that everything in my GUI is very small.
I tried to prevent that with this piece of code:
import ctypes
try:
ctypes.windll.shcore.SetProcessDpiAwareness(True)
except:
pass
But that didnt help at all. Does anybody have experience with a problem like that? What else could i try?

I think there is already a question similar to this in Stackoverflow. Anyway.
So far I think the only thing you can do is to set the app to use System (Enhanced) in the High DPI scaling override box.
It does not matter if you do not have a .exe file. You can change the properties of the resulting python app window when you run it as python myApp.py.
If the picture is not enough, there are more details in the first question here.

Related

How to change Windows resolution scaling using python

I'm trying to create a script that would automate a workflow with Python, I'm using PyAutoGui to find a image on screen and it locates and clicks on it.
The problem is that it will work with machines with my display settings (1920x1080, 100% scale), and will fail to locate when the scaling is changed (resolution can change, and it will work fine though). There's a good answer explaining how it works here: Running Pyautogui on a different computer with different resolution.
If the problem is with scaling, how can I programmatically do this step-by-step, that would work with any kind of display settings? I couldn't find any definitive answers so far:
Something that could do this with Python:
Start the program, get and save current scaling to variable
Change scaling to 100%
..... Code
Change scaling back to how it was and end the program

How to ignore UI scaling in Pyglet window?

Sorry right off the bat, my English is bad. I use google translate.
Faced such a problem:
On my laptop, the interface scale is 125%. The maximum resolution of the monitor is 1920x1080, and I work with it.
While creating the Pyglet application window, with a resolution of 1280x720, I noticed that the window is clearly larger than what I expected. Having changed the resolution to the maximum one available to me - 1920x1080, using the second monitor, I realized that it is clearly larger than the main monitor.
For a long time and painfully, I figured out the cause of the problem, but found it out. When I set the interface scaling to 100%, instead of 125% that was comfortable for me, everything fell into place. The windows began to work as intended.
But this is not the way to solve the problem. Therefore, I have come to you with a question. How do I ignore the zoomed-in laptop interface in my application? Also, an alternative solution could be to change the scale of the interface while the application is running, and with this I would also like to contact you. Can someone suggest how to implement one of the solutions?
I should have guessed that the same problem could be with Pygame.
Solution:
import ctypes
ctypes.windll.user32.SetProcessDPIAware()
https://gamedev.stackexchange.com/questions/105750/pygame-fullsreen-display-issue

Window resolution in Tkinter

I know that this might sound weird, but I have a problem considering the screen resolution of my Tkinter program. I have attached two pictures for a comparison.
I think you can clearly tell, what I'm talking about. The problem is that I don't really know why this happened. Suddenly the tkinter window had a way better resolution as you can see in the top picture. I did not change anything related to screensize/resolution by myself and was therefore expecting Tkinter to have published an update which just has better textures for every widget.
But because I had to reinstall python and all its modules this is no longer the case and the widgets look very blurry again (Bottom picture). Now I'm asking myself whether this has something to do with another version of Python or tkinter I'm using or what else could have been the reason for that.
I did not change my PC, Screen or anything like that. I just reinstalled python and its modules. Sadly I don't have the source code of the version where it looked great, but only an .exe file, because im continuously updating my program. But as I said before, I don't know what I could have changed which led to this huge resolution improvement.
I hope you get, what I'm trying to tell you.
Thanks in advance!
I was able so solve it!
I had a look on this question: on Stackoverflow
The answer from #binaryfunt solved my problem completely. So it was not really a tkinter/python thing, but rather windows itself.

Why is the Tkinter render quality much worse on windows?

I have developed a python app with Tkinter on a Mac. It involves forms, and canvas drawings. On the Mac, it looks great. However on my Dell laptop (4K display, and more powerful than my Mac), the Tkinter ui appears very pixelated and certain elements are located slightly differently. What is this problem known as and what can I do to render Tkinter better on Dell Windows 10 or other platforms in general?
Here is a screen shot of the same part of the UI (showing form and canvas drawing)...
Windows(bad)
Mac(normal)
Antialiasing is only enabled for Tkinter canvas object in OSX . You can get the aggDraw lib: http://effbot.org/zone/tkinter-aggdraw.htm as a workaround, but otherwise you will get jagged lines when trying to draw on a canvas. Fonts however should be anti-aliased on all major platforms.
The differences in the display of the same application are due to differences in render engines used by each Operating system.
This is coverd in a Pakt pub ebook called Tkinter GUI Application Development Blueprints
passage regarding this topic available here.
It may be a pain to do but it looks like the most common fix for this is to detect your enviroment and write independent styles using the external option database
more info is available in the documentation here.
Setting your DPI awareness to 1 should resolve your issue
from ctypes import windll
windll.shcore.SetProcessDpiAwareness(1)
Consider the resolution of the MAC as 1366x768 (expected),Suppose you are making your application windows size as 683x384 which is equal to (1366/2 x 768/2).
When the application will be run on a 4k Display it will display the dimensions as 683x384 for the main window but its dimensions on the 4k will be 4k/2.
So what you can do it write a general program with variable dimensions of the screens ,So that it will adjust its window size according to the screen size.
For more details refer to the https://www.tutorialspoint.com/python3/python_gui_programming.htm
Hope this will help.

How to make VLC click through

I have been all over the web looking for a solution to this problem!
I'm looking for a way to make my VLC window "click through" on linux.
I have found some python code here: https://stackoverflow.com/a/11917174/3426514 that says it can solve the problem, but I dont know how to apply that answer to my VLC window.
Is there a way to make a bash script that i can execute after vlc has started that will make the vlc window click-through? Or anything else, like a CCM plugin or a vlc plugin or magic foo?
I'm on ubuntu 14.04 if that is helpful :)
Edit: Another implemetation, part of the notifications code:
https://github.com/dkasak/notify-osd-customizable/blob/master/src/bubble.c#L1608
Edit2: A SVG Implementation, dont think this applies, but it is kinda relevant https://superuser.com/questions/699289/making-cairo-clock-click-through-able-cairo-graphics
Edit3: The used to be a compiz plugin called ghost a long long time ago https://github.com/compiz-reloaded/compiz-plugins-experimental
Edit4: To address the downvote to close: I expect the actual code to do this would be a few lines at most, i just have no clue how to do it. If there is something that I can provide to narrow the focus or provide more information, I will gladly do so.
Edit 5: Another related question. Create a click through window for Linux
You can have VLC write to the desktop background, then set all your app windows to be partially transparent. Output to Background is a VLC option. What you want is backwards from that, where VLC is overlayed on top of everything else, but ignored for user input, however if you don't mind going the other way, it's "already in there" 8-)

Categories

Resources