473,594 Members | 2,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PyQt calling an external app?

What's the easiest and cleanest way of having PyQt bring up an external
application? In this case I am looking to launch Internet Explorer and
bring up a specific URL. I don't care about tracking the IE process'
activity and don't want PyQt to wait until the browser is closed. I
tried the following code from within a PyQt app:

import os

url = 'http://server.domain.c om/page.html'
os.system('star t %s' % url)

When I use this the PyQt app freezes up and only when I forcefully
close it does the browser window pop up. Then I looked into QThreads
and some other choices. Here's my latest attempt, using win32process:

import win32process

url='http://server.domain.c om/page.html'
cmd_line = 'start %s' % url
win32process.Cr eateProcess(Non e, cmd_line, None, None,
1,win32process. CREATE_NEW_CONS OLE, None, None,
win32process.ST ARTUPINFO())

When I try this I get a message stating 'The system cannot find the
file specified' when the cmd_line is being interpreted. I am using
Python 2.3.5 on Windows 2000 Professional, with Qt 2.3.0 and PyQt 3.13.
Do I have to go to the lengths of implementing a QThread just to spawn
an external program I don't care about tracking?

Jan 9 '06 #1
4 5254
gregarican wrote:

[os.system using the start command on Windows]
When I use this the PyQt app freezes up and only when I forcefully
close it does the browser window pop up.


What does os.startfile do when invoked with the URL? My impression was
that the startfile function - available only on Windows - doesn't wait
for the command to finish, but I don't run Windows and can't test this.
Any feedback would be appreciated, though, since it's part of the
desktop module I proposed a while back:

http://www.python.org/pypi/desktop

Paul

Jan 9 '06 #2
Paul Boddie wrote:
What does os.startfile do when invoked with the URL? My impression was
that the startfile function - available only on Windows - doesn't wait
for the command to finish, but I don't run Windows and can't test this.
Any feedback would be appreciated, though, since it's part of the
desktop module I proposed a while back:

http://www.python.org/pypi/desktop
Paul


Thanks! That worked perfectly. Sorry for all of the n00b questions, as
I'm only about a week or two into learning Python. I had about 1+ year
of experience coding in Ruby and am trying to translate a Qt app I
wrote in Ruby into Python. So there are some differences in each
language's Qt implementation. So far I am very impressed with Python's
maturity in terms of language consistency and available libraries. Plus
everyone is very responsive within the community.

Thanks again!

Jan 9 '06 #3
gregarican wrote:
What's the easiest and cleanest way of having PyQt bring up an
external application?


You can also go the Qt way and use QProcess. This also gives you cross-platform
communication and process killing capabilities which are pretty hard to obtain
(see the mess in Python with popen[1234]/subprocess). You also get nice signals
from the process which interact well in a Qt environment.
--
Giovanni Bajo
Jan 10 '06 #4
Giovanni Bajo wrote:
You can also go the Qt way and use QProcess. This also gives you cross-platform
communication and process killing capabilities which are pretty hard to obtain
(see the mess in Python with popen[1234]/subprocess). You also get nice signals
from the process which interact well in a Qt environment.
--
Giovanni Bajo


Good point. I don't think that this particular class is available with
Qt 2.3.0, which is what I am using for my Sharp Zaurus and Win32
implementations of this app. Once I move up to the world of Qt 4 I will
definitely look into this as an option for certain things. My next
quest will be rewriting this app (again) so that it will run on Windows
Mobile PDA's using Python and Tkinter for the GUI. Since all of the
data pushes/pulls relies on XMLRPC it shouldn't be too daunting. Just
need to present the data nicely :-)

Jan 10 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2849
by: Ilya Knizhnik | last post by:
Dear All, I am fairly new to Python. I have found it an easy language to learn and a very usefull one for many tasks. Currently I am working on a python project that involves a GUI and it was suggested that PyQt is the best way to design that GUI. However since PyQt is rather new, I have not found much documentation on it, or examples in it. The only useful tutorial/book I have found is at www.opendocspublishing.com/pyqt/ but it is...
2
4208
by: Srinath Avadhanula | last post by:
Hello, I am wondering if QT has something like QWaitForNextEvent() function. This function would block execution of the application till another key was pressed and then return the event which occured. Would like to utlize this in a small application I am building: I am trying to create vi key-bindings for a simple QMultiLineEdit
35
7745
by: Vamsi Mudrageda | last post by:
I am kind of new to Python, and after trying and using wxPython, I found it kind of lacking in easy-to-read documentation, speed at loading, and GUI response-time. So I am looking for an another GUI toolkit that is cross-platform for Python, and am leaning toward PyQt (PyGTK is kind of dull looking in comparison). Unfortunately, although TrollTech says Qt is cross-platform, its license strategy has me a bit confused. So here is to...
8
4845
by: simo | last post by:
OK, so I'm at the stage where I want to make a choice between wxPython and PyQt. Currently I'm using wxPython mainly due to the fact that it has GPL Linux and Windows versions. I prefer Qt to wxWindows, but am confused with all the Windows licensing issues. For the moment this is just for my own tinkering and utility apps, but
10
2198
by: svenn.are | last post by:
Hi, I wanted to run a program that is written in PyQt on my mac, and went over to Riverbank to get PyQ 3.13 and SIP 4.1.1 sources. I followed the installation guide except for the compiling python as Macosx already has python. I had no problem with compiling SIP and also no problem with compiling PyQt nor did I have any error message during make install.
3
2066
by: Fabio | last post by:
Hi all, I'm about to write an application, and I'd like to use PyQt, but before choosing this toolkit I would like to clarify some particular licensing issues; if some user has already touched these, I would like to hear from his experiences. This app should be cross-platform, so, given qt licensing policies, I would buy a commercial PyQt license and a commercial Qt license. Could I license the application under the GPL for Gnu/Linux...
10
2153
by: Simon John | last post by:
After quite a while of wxPython I'm getting back into PyQt, mainly due to the announcement by Trolltech that they will make a GPL version of Qt4 for Windows (and Phil-T said he will make a PyQt to go with it eventually!) I'm currently using PyQt 3.12 that comes with the BlackAdder demo, it seems to work fine with Python 2.3.5 except that it doesn't support the WinXP look'n'feel, the QStyle "WindowsXP" isn't included, and using a...
3
2066
by: Phil Thompson | last post by:
Riverbank Computing is pleased to announce the release of PyQt v4.0beta1 available from http://www.riverbankcomputing.co.uk/pyqt/. PyQt is a comprehensive set of Qt bindings for the Python programming language and supports the same platforms as Qt (Windows, Linux and MacOS/X). Like Qt, PyQt is available under the GPL and a commercial license. PyQt v4 supports Qt v4 (http://www.trolltech.com/products/qt/index.html). PyQt v3 is still...
6
4076
by: king kikapu | last post by:
Hi, this is actually goes to whoever is using Eclipse and Eric4, the IDE that comes bundled with PyQt. I was using Eclipse until i saw Eric4 and i started experiment with it, very nice work. Eric4 has a feature that actually reminds us the work of some expensive IDEs, like Visual Studio, Delphi and the like: when you compile your project, it checks to see if some .ui files (Qt Designer form files) has changed and if so, it call...
0
7941
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
7874
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8246
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8368
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8000
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8231
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5404
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3895
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.