0

So I want to find out the program that system() uses in this code, to open it that way and be able to change the location.

import os
import ctypes
import tkinter
import pywinauto
user32 = ctypes.windll.user32
screensX = user32.GetSystemMetrics(0)
screensY = user32.GetSystemMetrics(1)
app = pywinauto.application.Application()
app.start(os.system("Simplicity_TheFinerArtOfCreatingSoftware_CheatSheet_1Page.pdf"))
window = app.window()
xdiv2=screensX/2
ydiv2=screensY/2
window.move_window(x=-50, y=0, width=xdiv2, height=ydiv2, repaint=True)

since this code will resort in an error (since system(x.pdf) isn't an .exe file.

I suspected this error while I was making the program, but don't know how else to do it.

  • 1
    Note that, as also stated in PEP 8: "Wildcard imports (from import *) should be avoided, as they make it unclear which names are present in the namespace, confusing both readers and many automated tools.". It also makes difficult to see which module defines the names you use in your code. – Thierry Lathuille Nov 02 '22 at 19:20
  • @ThierryLathuille I understand, fixed it. – Jelte Dijkmans Nov 02 '22 at 19:55
  • I don't understand your question. As stated in [the documentation](https://docs.python.org/3/library/os.html#os.system) for `os.system`, it simply executes the command passed as a string parameter, as if you had entered it in some terminal, nothing more. If you want to launch some app, you have to explicitely do so. – Thierry Lathuille Nov 02 '22 at 21:39
  • That i do know, but I want to find the standard file opener for pdf's, so i can open it and change its size and position on the screen. I do not know how to find the standar pdf opener's exe. – Jelte Dijkmans Nov 03 '22 at 08:00
  • What about [os.startfile](https://docs.python.org/3/library/os.html#os.startfile)? – Thierry Lathuille Nov 03 '22 at 11:41
  • 1
    @VasilyRyabov That did indeed work after changing my code a lot. Wasn't able to find it before. Thanks – Jelte Dijkmans Nov 04 '22 at 15:04

0 Answers0