Alfred
Alfred

Reputation: 43

variable is not going to QPixmap.grabWindow in Windows but is in Linux

I'm trying to write a small screen capture app that should work in both Windows and Linux. I'm using PyQt4 to get the screen shot and it works great in Linux, but for some reason in Windows 8, it's not passing the variable or it can't read it. If I put the variable in quotes of course that works, but that's not what I want to do.

t0 = now.strftime("%Y-%m-%d %H:%M:%S")

QPixmap.grabWindow(QApplication.desktop().winId()).save(t0, 'png')

Upvotes: 0

Views: 54

Answers (1)

ekhumoro
ekhumoro

Reputation: 120588

On Unix filesystems, you can use any character in a filename other than "/" and null.

But on Windows, there are a whole load of additional restrictions. The specific problem in your case, is that you are using colons (":") in your filename, which is not allowed.

So try something like this instead:

    t0 = now.strftime("%Y-%m-%d %H_%M_%S")

Upvotes: 1

Related Questions