Search Results

Search found 173 results on 7 pages for 'pyqt'.

Page 6/7 | < Previous Page | 2 3 4 5 6 7  | Next Page >

  • PySide Qt script doesn't launch from Spyder but works from shell

    - by Maxim Zaslavsky
    I have a weird bug in my project that uses PySide for its Qt GUI, and in response I'm trying to test with simpler code that sets up the environment. Here is the code I am testing with: http://stackoverflow.com/a/6906552/130164 When I launch that from my shell (python test.py), it works perfectly. However, when I run that script in Spyder, I get the following error: Traceback (most recent call last): File "/home/test/Desktop/test/test.py", line 31, in <module> app = QtGui.QApplication(sys.argv) RuntimeError: A QApplication instance already exists. If it helps, I also get the following warning: /usr/lib/pymodules/python2.6/matplotlib/__init__.py:835: UserWarning: This call to matplotlib.use() has no effect because the the backend has already been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot, or matplotlib.backends is imported for the first time. Why does that code work when launched from my shell but not from Spyder? Update: Mata answered that the problem happens because Spyder uses Qt, which makes sense. For now, I've set up execution in Spyder using the "Execute in an external system terminal" option, which doesn't cause errors but doesn't allow debugging, either. Does Spyder have any built-in workarounds to this?

    Read the article

  • How to replace a Widget with another using Qt ?

    - by Natim
    Hi, I have an QHBoxLayout with a QTreeWidget on the left, a separator on the middle and a widget on the right. When I click on the QTreeWidget, I want to change the widget on the right to modify the QTreeWidgetItem I tried to do this with this code : def new_rendez_vous(self): self.ui.horizontalLayout_4.removeWidget(self.ui.editionFormWidget) del self.ui.editionFormWidget self.ui.editionFormWidget = RendezVousManagerDialog(self.parent) self.ui.editionFormWidget.show() self.ui.horizontalLayout_4.addWidget(self.ui.editionFormWidget) self.connect(self.ui.editionFormWidget, QtCore.SIGNAL('saved'), self.scheduleTreeWidget.updateData) def edit(self, category, rendez_vous): self.ui.horizontalLayout_4.removeWidget(self.ui.editionFormWidget) del self.ui.editionFormWidget self.ui.editionFormWidget = RendezVousManagerDialog(self.parent, category, rendez_vous) self.ui.editionFormWidget.show() self.ui.horizontalLayout_4.addWidget(self.ui.editionFormWidget) self.connect(self.ui.editionFormWidget, QtCore.SIGNAL('saved'), self.scheduleTreeWidget.updateData) def edit_category(self, category): self.ui.horizontalLayout_4.removeWidget(self.ui.editionFormWidget) del self.ui.editionFormWidget self.ui.editionFormWidget = CategoryManagerDialog(self.parent, category) self.ui.editionFormWidget.show() self.ui.horizontalLayout_4.addWidget(self.ui.editionFormWidget) self.connect(self.ui.editionFormWidget, QtCore.SIGNAL('saved'), self.scheduleTreeWidget.updateData) But it doesn't work and all the widgets are stacked up on each other : . Do you know how I can remove the old widget and next display the new one ?

    Read the article

  • Python: Embed Chaco in PyQt4 Mystery

    - by random guy
    How do i go about adding Chaco to an existing PyQt4 application? Hours of searches yielded little (search for yourself). So far i've figured i need the following lines: import os os.environ['ETS_TOOLKIT']='qt4' i could not find PyQt4-Chaco code anywhere on the internets i would be very grateful to anyone filling in the blanks to show me the simplest line plot possible (with 2 points) from PyQt4 import QtCore, QtGui import sys import os os.environ['ETS_TOOLKIT']='qt4' from enthought <blanks> : : app = QtGui.QApplication(sys.argv) main_window = QtGui.QMainWindow() main_window.setCentralWidget(<blanks>) main_window.show() app.exec_() print('bye') what Chaco/Enthought class inherits from QWidget ?

    Read the article

  • How can I get rid of the resize-handle in a QDialog?

    - by Georg
    I've got the following class: class SelectDateDialog(QDialog): startDate = date.today() endDate = date.today() def __init__(self, text, isInterval = False): QDialog.__init__(self) uic.loadUi("resources/SelectDate.ui", self) Now, the dialog is resizable on Mac OS X 10.5, but it shouldn't be. It has the resize-handle in the lower right corner. I've already tried the setSizeGripEnabled function, it didn't change anything. How can I make it not resizable?

    Read the article

  • Tying PyQt4 QAction triggered() to local class callable doesn't seem to work. How to debug this?

    - by Jon Watte
    I create this object when I want to create a QAction. I then add this QAction to a menu: class ActionObject(object): def __init__(self, owner, command): action = QtGui.QAction(command.name, owner) self.action = action self.command = command action.setShortcut(command.shortcut) action.setStatusTip(command.name) QtCore.QObject.connect(action, QtCore.SIGNAL('triggered()'), self.triggered) def triggered(self): print("got triggered " + self.command.id + " " + repr(checked)) Unfortunately, when the menu item is selected, the 'triggered' function is not called. QtCore.QObject.connect() returns True. Nothing is printed on the console to indicate that anything is wrong, and no exception is thrown. How can I debug this? (or, what am I doing wrong?)

    Read the article

  • how to create multiple selections in text edit box in qt4?

    - by Ronny
    Qt3.3 used to allow for multiple selections in the QTextEdit widget by calling the setSelection() function and specifying a different selection id (selNum) as the last argument in that function. In Qt4, to create a selection, I do it by creating a QTextCursor object and call the setPosition() or movePosition() methods. I have no problems being able to create a single selection of text. I am, however, unable to find a way to create multiple selections. The methods in Qt4 do not have an argument which allows you to set a selection id, nor can i find any other function in the QTextCursor or QTextEdit which looks like it might allow me to do so. Has this feature been completely removed from Qt4? or has is there a new and different way of doing it? Thanks. Ronny

    Read the article

  • Qt: How to autoexpand parents of a new QTreeView item when using a QSortFilterProxyModel

    - by taynaron
    I'm making an app wherein the user can add new data to a QTreeModel at any time. The parent under which it gets placed is automatically expanded to show the new item: self.tree = DiceModel(headers) self.treeView.setModel(self.tree) expand_node = self.tree.addRoll() #addRoll makes a node, adds it, and returns the (parent) note to be expanded self.treeView.expand(expand_node) This works as desired. If I add a QSortFilterProxyModel to the mix: self.tree = DiceModel(headers) self.sort = DiceSort(self.tree) self.treeView.setModel(self.sort) expand_node = self.tree.addRoll() #addRoll makes a node, adds it, and returns the (parent) note to be expanded self.treeView.expand(expand_node) the parent no longer expands. Any idea what I am doing wrong?

    Read the article

  • how to change headers data

    - by Moayyad Yaghi
    hello i have the following class class AssetTableModel(QtCore.QAbstractTableModel): def init(self,filename=''): super(AssetTableModel,self).init() self.fileName=filename self.dirty = False self.assets = [] self.setHeaderData(0,QtCore.Qt.Horizontal,QtCore.QVariant('moayyad'),QtCore.Qt.EditRole) and i need to change the headers of the columns or the rows ,i used ( self.setHeaderdata()) but its not working ,i have a table that consistes of 2 columns and 2 rows only. is there any other function that changes headers ??. please help thanx in adnvance

    Read the article

  • How to set visibility for textblocks in QTextEdit?

    - by serge
    Hi everyone, i tried to hide textblock's in QTextEdit, but it doesn't work: block = textedit.document().begin() block.setVisible(False) This code works fine for QPlainTextEdit, but not for QTextEdit. In documentation i haven't found any mention of how it should work for QTextEdit, just following: void QTextBlock::setVisible ( bool visible ) Sets the block's visibility to visible. This function was introduced in Qt 4.4. See also isVisible(). How can i hide block's in QTextEdit? Thank you in advance

    Read the article

  • More compact layout

    - by Jesse Aldridge
    In the following code, I'd like to get rid of the margin around the buttons. I'd like to have the buttons stretch all the way to the edge of the frame. How can I do that? import sys from PyQt4.QtGui import * from PyQt4.QtCore import * app = QApplication(sys.argv) window = QWidget() layout = QVBoxLayout() layout.setSpacing(0) window.setLayout(layout) for i in range(2): layout.addWidget(QPushButton()) window.show() app.exec_()

    Read the article

  • Trouble getting QMainWindow to scroll

    - by random
    A minimal example: class MainWindow(QtGui.QMainWindow): def __init__(self, parent = None): QtGui.QMainWindow.__init__(self, parent) winWidth = 683 winHeight = 784 screen = QtGui.QDesktopWidget().availableGeometry() screenCenterX = (screen.width() - winWidth) / 2 screenCenterY = (screen.height() - winHeight) / 2 self.setGeometry(screenCenterX, screenCenterY, winWidth, winHeight) layout = QtGui.QVBoxLayout() layout.addWidget(FormA()) mainWidget = QtGui.QWidget() mainWidget.setLayout(layout) self.setCentralWidget(mainWidget) FormA is a QFrame with a VBoxLayout that can expand to an arbitrary number of entries. In the code posted above, if the entries in the forms can't fit in the window then the window itself grows. I'd prefer for the window to become scrollable. I've also tried the following... replacing mainWidget = QtGui.QWidget() mainWidget.setLayout(layout) self.setCentralWidget(mainWidget) with mainWidget = QtGui.QScrollArea() mainWidget.setLayout(layout) self.setCentralWidget(mainWidget) results in the forms and entries shrinking if they can't fit in the window. Replacing it with mainWidget = QtGui.QWidget() mainWidget.setLayout(layout) scrollWidget = QtGui.QScrollArea() scrollWidget.setWidget(mainWidget) self.setCentralWidget(scrollWidget) results in the mainwidget (composed of the forms) being scrunched in the top left corner of the window, leaving large blank areas on the right and bottom of it, and still isn't scrollable. I can't set a limit on the size of the window because I wish for it to be resizable. How can I make this window scrollable?

    Read the article

  • QComboBox returns None Type . How to get Current Data ?

    - by vettipayyan
    I've implemented 2 QComboBoxes with one having items manually inserted every time and another one having items inserted with a list (I'm using Python ) But when i attempt to get the current value of Combobox , it returns None . I proceeded as specified in this question : I referred this i have provided wat i've coded ."command" and "option" are QComboBoxes ( Pardon me for bad style) Is there any mistake in Indexes ? self.command.insertItem(1,'Convert') self.command.insertItem(2,'Compose') self.command.insertItem(3,'Animate') self.option.insertItems(268,list) and retrieval : self.selected_com=self.command.itemData(self.command.currentIndex()) self.selected_opt=self.option.itemData(self.option.currentIndex())

    Read the article

  • Looking for PyQt4 embeddable terminal widget

    - by redShadow
    I wrote an application that, among other things, launches some "backend" processes to do some stuff. These subprocesses are very likely to fail or have unexpected behavior since they have to operate in quite hard conditions, so I prefer to give full control over them to the operator. NOTE: I am running these processes using a subprocess module based class instead of QProcess to have some more control functionality over the running process. At the moment, I'm using a QPlainTextEdit widget to which I append standard output/error from the subprocess, plus some buttons to quickly send some common signals (INT, STOP, CONT, KILL, ..), but: In some cases it would be useful to send some input too. Although it could be done with a text input box, I would prefer using something more "professional" Of course, there is no direct way to interpret special control characters, such as color codes, cursor movement, etc.. I had to implement an auto-scroll management of the console, but it is not guaranteed 100% to work nicely (sometimes the scroll locking doesn't work as expected, etc.) So: does anyone know something I could use to accomplish these needs? I found qtermwidget but it seems more oriented on handling a shell process (and the Python bindings seems to let you run /bin/bash only) by itself than communicating with an already existing process I/O.

    Read the article

  • Patterns to refactor common code in multi-platform software

    - by L. De Leo
    I have a Django application and a PyQt application that share a lot of code. A big chunk of the PyQt application are copied verbatim from the Django application's views. As this is a game, I have already an engine.py module that I'm sharing among the two applications, but I was wondering how to restructure the middle layer (what in Django corresponds to the largest part of the views minus the return HttpResponse part) into its own component. In the web application the components are those of a classic Django application (with the only exception that I don't make any use of models): the game engine the url dispatcher the template the views My PyQt application is divided into: the game engine the UI definition where I declare the UI components and react to the events (basically this takes the place of the template and the url dispatcher in the Django app) the controller where I instantiate the window object and reproduce the methods that map the views in the Django app

    Read the article

  • ImportError: No module named QtWebKit

    - by Hallik
    I am on centos5. I installed python26 source with a make altinstall. Then I did a: yum install qt4 yum install qt4-devel yum install qt4-doc From riverbankcomputing.co.uk I downloaded the source for sip 4.10.2, compiled and installed fine. Then from the same site I downloaded and compiled from source PyQt-x11-4.7.3 Both installs were using the python26 version (/usr/local/bin/python2.6). So configure.py, make, and make install worked with no errors. Finally, I tried to run this script, but got the error in the subject of this post: import sys import signal from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import QWebPage def onLoadFinished(result): if not result: print "Request failed" sys.exit(1) #screen = QtGui.QDesktopWidget().screenGeometry() size = webpage.mainFrame().contentsSize() # Set the size of the (virtual) browser window webpage.setViewportSize(webpage.mainFrame().contentsSize()) # Paint this frame into an image image = QImage(webpage.viewportSize(), QImage.Format_ARGB32) painter = QPainter(image) webpage.mainFrame().render(painter) painter.end() image.save("output2.png") sys.exit(0) app = QApplication(sys.argv) signal.signal(signal.SIGINT, signal.SIG_DFL) webpage = QWebPage() webpage.connect(webpage, SIGNAL("loadFinished(bool)"), onLoadFinished) webpage.mainFrame().load(QUrl("http://www.google.com")) sys.exit(app.exec_()) Even in the beginning of the configure for pyqt4, I saw it say QtWebKit should be installed, but apparently it's not? What's going on? I just did a find, and it looks like it wasn't installed. What are my options? [root@localhost ~]# find / -name '*QtWebKit*' /root/PyQt-x11-gpl-4.7.3/sip/QtWebKit /root/PyQt-x11-gpl-4.7.3/sip/QtWebKit/QtWebKitmod.sip /root/PyQt-x11-gpl-4.7.3/cfgtest_QtWebKit.cpp

    Read the article

  • Problem installing PyQt4 on Windows 7

    - by alfredozn
    I have a problem installing PyQt4. I have Windows 7 with Python 3.1.2 installed. When I execute the PyQt-Py3.1-gpl-4.7.3-2.exe it shows the warning: This copy of PyQt has been built against Python v3.1 which doesn't seem to be installed. Do you wish to continue with the installation? Why the installer can't see my python installtion???, I set the PYTHONHOME env variable and added python to the PATH variable but is always the same warn. I don't know if the last .2 in my python's version is the problem. If I ignore the warning and install the PyQt, when I try to run the Examples and Demos from the All Programs menu it doesn't show anything. Im new to python and Qt, I don't know how to debug or something to solve this problem =S

    Read the article

  • PySide 1.0.0 beta 2, le support complet des interfaces déclaratives arrive dans ce bindind LGPL Python de Qt

    Voici donc sortie la deuxième beta de PySide, le binding Python de Qt initié par Nokia, dont la principale différence avec le binding historique, PyQt, réside dans la licence : PySide est disponible sous LGPL, une licence moins restrictive que la GPL employée par PyQt. Ainsi, un binding Python de Qt peut être utilisé pour des développements propriétaires sans obligation de payer une licence commerciale. La première version beta de PySide (la bien dénommée beta 1) apportait un grand changement par rapport aux versions précédents (0.4.2 et avant) : un changement dans l'ABI (Application Binary Interface), ce qui, pour rester en dehors des détails techniques, obligeait à recompiler toute application se basant sur PySide (notamment le module Python). Cependant, ainsi, le projet ...

    Read the article

  • As a Qt GUI programmer, how to improve (career & skill)?

    - by linjunhalida
    hello, I'm a python & Qt programmer, and my daily job is create small PC GUI programs ship with hardware devices. the problem is, My job is simple, read/write data to device by using serial port(pyserial), display and edit data(PyQt + PyQwt), that's all. although I'm a linux user, my program is running under windows XP, but thanks to PyQt, I can still develop under linux. And I'm always afraid of being replaced by the people cheaper and younger than me in the future. (I'm 26 now.. not too much time for playing..) So I need improve myself, and make me more competitive in the global market, and I like programming, and want coding till the end of my life. any roadmap suggestion?

    Read the article

  • How do I install Kodos in 12.10?

    - by Brutus
    In previous Ubuntu version I used Kodos extensively. But the package has been dropped in 12.10. It's a neat regular expression testing tool. It's hard to find an alternative that is not Windows only (or Air, or uses action script which bails on more complicated RegEx, or works in Wine - well kinda, but not really..., etc.). So I tried to install Kodos from source, which seems to work (download sourceball and setup.py) but it won't run because of missing PyQT dependencies (that I can't manage to fulfill with anything install-able trough standard packages). I then tried to install PyQT manually (which seems to require manual install of SIP and QT too) and instead of pip I have to use configure.py and qmake. It throws error after error at me. I tried to overcome one after another for over an hour but no luck. It even managed to break Calibre and Music Brains Picard. So I purged all the stuff, reinstalled python-sipand python-qt4 from the standard packages and gave up. Has anyone managed to get Kodos running on 12.10? Or any hints on how to do it?

    Read the article

< Previous Page | 2 3 4 5 6 7  | Next Page >