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
Related
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.
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.
I need to make a sub window using The pygame package, I want to do two type of subwindow, the first fixed in of the window and the second type completely independent of the window.
While approaching this problem, be aware that two windows is pretty much impossible for Pygame, since it is dependent on SDL and SDL is limited to 1 screen.
Maayyybbe, you could run two different programs that have different windows and can interact with each other via some networking you set up. But at this point, you'd probably be better off coding in something else.
Making a sort of subwindow is doable by splitting up your screen, and to use parts of it for one thing, and others for something else. For example, you can blit images to this separate "window" that have totally different things going on than the stuff outside of it.
Also, please google before posting a question, a quick google search revealed Pygame with Multiple Windows, which answers half of your question.
Hi I am new to this whole coding thing I was suggested to use Python. The version I have now is 2.7. I need help with making a transparent window to the copacity of 100 so that you can actually see through it and I also want to know how to make a fairy thick, out line of a rectangle in the colour red.
Help me please :S Thanks!
Unfortunatelly, there is not such an easy thing as sa "trasnparent window" - althougmodern widnow managaers do have various opacity controls for the windows, those just affect the windows as a whole - and do not integrate at all with the program running "inside" the windows. There may even be, for some of them, a way to call functions to explicitly set up the opacity level of a given window, but I don't think it willbe possible for all of them.
That said, it is possible to get grab of the "root" window and draw directly on the screen - -bypassing the window manager. There are APIs for that at least on Windows and Linux (you have to mention in what operating system you need that working) - but it will amount to not a trivial research work, since this is not what is expected of a "well behaved app" - for which the GUI toolkits are written and documented. You will need to write xlib code in Linux, and directly call win32 api's on windows - both are possible from Python - as possible as under-documented.
And once you get to draw the rectangle, since you are bypassing the window manager, you willhave to care about every low-level detail of your app: mouse event handling, screen-redrawing (and notifying the system of drawing taking effect over other windows), and so on.
I'd like to hear the best means for displaying graphics that move on-screen as an overlay with Python. The intended initial platform is Linux. I've worked up some small demos using PyQt using frameless windows and looping and updating their location on screen. This works, but I have a feeling it is not the ideal solution.
The end result is an activity indicator that would show more objects swarming in an upward direction as activity increased. That would result in spawning perhaps a hundred windows in a go and that is why I think my PyQt demo is not optimal.
I'm open to any suggestions since this will be an open project and installing obscure modules is a non-issue.
There are examples for making transparent / unclickable windows in java and in javascript. Here are a couple of transparency related posts for QT.