When using tkinter to create a more modern looking application, I looked to MS Word to inspire my design. Then I noticed that only when I'm using the application on a High DPI device that it looks so terrible.
Is there a way to compensate and make it look just as crisp?
NOTE: "Don't use tkinter" is not on the table.
The best solution I have found for this is to create a custom widget using the WCK (Widget Construction Kit). Text displayed using this is automatically Anti-Aliased.
Try typing this at the beginning of your code
try:
from ctypes import windll
windll.shcore.SetProcessDpiAwareness(1)
except:
pass
I think this will solve your problem.
Related
I want to write something like a taskbar/dock/panel(like tint2,...) with pyQt5.
I know how to write regular GUI applications with it, but my tiling window manager(herbstluftwm) maximizes my panels and openbox makes them resizable etc.
My question : How can I make pyQt show my application as a panel instead of a window? I haven't found anything about that in the documentation.
Thank you.
Thanks to musicamente's help, i could find that the function setWindowFlags() is what I need. It allows to change the behavior of a window.
A website explaining this function is https://pythonprogramminglanguage.com/pyqt5-window-flags/
Using Windows 10 64bit
I'm trying to learn how to code in python and I decided to make my first program a simple bot for a game.
The game is a downloadable game.
The goal is for my mouse to click a button at coordinates (200, 200)
I have tried many different ways to get this to work.
I've tried...
PyAutoGui
pywin32
ctypes
PyAutoGui implementation
pyautogui.click(200, 200)
pywin32 implementation
import win32api, win32con
def click(x,y):
win32api.SetCursorPos((x,y))
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
click(10,10)
Any ideas? From what I understand I need to use a low level driver?
I just don't understand how to emulate it as if a real mouse was clicking
try pyautogui.mouseDown() or pyautogui.mouseUp() instead...
info: https://automatetheboringstuff.com/chapter18/
Make sure, that you set the raw input checkbox in game settings for the mouse. I had the same issue with CSGO
Not sure if this will work with your game but you can use PyUserInput.
The goal of the program i'm trying to write is a bot that can click and play flash games and press keys inside a window webpage even when I do not have the window selected. My question is very similar to this. What I want to know is how to use win32, selenium, and PIL to take screenshots, analyze the screenshots, and click and press buttons accordingly from the bot. I've looked through the win32api documentation and found little about how to click inside a window in the background.
If someone could give a link to someone who has done this before or just a little nudge in the right direction would be amazing!
pywinauto is even simpler, but it may not recognize Flash controls. The code should just look a bit shorter:
import pywinauto
app = pywinauto.Application().connect(path='process_name.exe')
app.MainDialog.click_input(coords=(953, 656))
To check which controls are visible:
app.MainDialog.print_control_identifiers()
P.S. If you work with Python 3.x, this clone is compatible with Py3.
If your goal is detecting and interacting with images on screen, you might want to take a look at Sikuli. This is exactly what it does. Sikuli automates anything you see on the screen. It uses image recognition to identify and control GUI components. It is especially useful when there is no easy access to a GUI's internal or source code. More info here.
In gtk-2 it was possible to make an animated striped progressbar. Is this really not possible with gtk-3? I've looked everywhere on the internet and at the gtk-3 documentation and have not found anything that indicates that it is possible.
Do you mean, you want the GtkProgressBar pulsing? Use gtk_progress_bar_pulse (GtkProgressBar *widget). If this is about Theming gtk, animation control by the engine. For more animation you have to code the engine yourself, unfortunately, which is same with gtk+-2.0. Read GtkStyleContext documentation for more clearer.
couldn't find anything with google or search.
I have some QPushButtons and QLabels in a QVBoxLayout. Now I want them to scale down. Not only the text, the hole QButton and QLabel. Is that possible? If yes, can you please tell me how or post me a link to the doc. I'm pretty sure, that there must be a way. But I think I'm searching with the wrong words.
Not sure what you mean, but perhaps you're looking for QBoxLayout::addStretch? By the way, I recommend using Qt Designer to create your layout, PyQt4 comes with a tool called pyuic4 that creates the Python code for you. Qt Designer allows you to visually insert spacer items.