pyside

problem displaying sympy rendered svg in python

时光毁灭记忆、已成空白 提交于 2019-11-29 11:18:27
I have the following program which uses sympy and svgmath to render a user's algebraic expression. It nearly works but there are a few issues: The svg is not actually produced until the program exits so obviously cannot be diplayed. Is there a way to improve the performance (not looking up 'svgmath.xml' every time etc.)? Does an actual svg file need to be produced? Can svgmath pass output directly to the QSvgWidget? Many thanks and best wishes. from __future__ import division import sys import sympy from PySide.QtGui import * from PySide.QtCore import * from PySide.QtXml import * from PySide

Can EXE generated by cx_freeze be completely decompiled back to readable Python code?

本秂侑毒 提交于 2019-11-29 10:36:00
I'm new to python, and I'm evaluating developing desktop programs with Python + PySide, and found that cx_freeze works very good in converting my python code into executables, and it's cross-platform. My question is, can someone else decompile an EXE generated by cx_freeze back to fully readable code , as if my original source code? Note: I'm not worried about someone cracking my program, but just don't want someone else can take my code and developed base on it. Thanks. In general - no. CX Freeze and py2exe store the PYC version of your code, the bytecode compiled from the PY files. Currently

PyQt/PySide - icon display

人走茶凉 提交于 2019-11-29 09:08:27
问题 I have a PySide app which has an icon for the MainWindow (a QMainWindow instance). When I run the file normally, the icon is visible and everything is fine but when I create an exe with py2exe , the icon does not appear. This happens with cx_freeze also( so I don't think the problem's with py2exe ). The app was designed using QtDesigner and converted to python with pyside-uic . I tried both using icons as a file and as a resource(qrc file) and both don't seem to work. Any help or pointers

A QApplication instance already exists

时间秒杀一切 提交于 2019-11-29 07:23:59
I'm doing some simple PySide on 3Dsmax 2015. This is my error: python.ExecuteFile "C:\Program Files\Autodesk\3ds Max 2015\scripts\Python\demoUniTest.py" -- Runtime error: Line 32 <module>() <type 'exceptions.RuntimeError'> A QApplication instance already exists. This is my code: import sys from PySide.QtCore import * from PySide.QtGui import * from math import * class Form(QDialog): def __init__(self,parent=None): super(Form,self).__init__(parent) self.browser = QTextBrowser() self.lineedit = QLineEdit("Type an expression and press Enter") self.lineedit.selectAll() layout = QVBoxLayout()

How to create a filter for QTableWidget?

爱⌒轻易说出口 提交于 2019-11-29 05:11:00
I'm trying to create a filter for QTableWidget with QLineEdit in PySide. I've seen some tutorials using QSortFilterProxyModel for C++ but couldn't understood how to do it in Python. I need to search in 'VALUE' column. Trilarion A QSortFilterProxyModel is a proxy model, that means that you put it between the your complete data model and a view. The comment by titusjan is good, you can look in your local PySide/PyQt installation for basicsortfiltermodel.py to get an example in Python. Also, instead of using a QTableWidget a QTableView is sufficient - you won't need the inbuilt model of

Use keyPressEvent to catch enter or return

*爱你&永不变心* 提交于 2019-11-29 04:34:47
I have a simple form with some combos, labels, buttons and a QTextEdit. I try to catch the enter or return key with keyPressEvent, but for some reason I'm not able to. The ESC key however, that I also use, is recognized. Here's a piece of the code: def keyPressEvent(self, e): print e.key() if e.key() == QtCore.Qt.Key_Return: self.created.setText('return') if e.key() == QtCore.Qt.Key_Enter: self.created.setText('enter') if e.key() == QtCore.Qt.Key_Escape: self.cmbEdit = not(self.cmbEdit) if self.cmbEdit: etc... Am I missing something? It's not completely clear from your code, but it looks like

convert a list of delimited strings to a tree/nested dict, using python

↘锁芯ラ 提交于 2019-11-29 02:35:17
I am trying to convert a list of dot-separated strings, e.g. ['one.two.three.four', 'one.six.seven.eight', 'five.nine.ten', 'twelve.zero'] into a tree (nested lists or dicts - anything that is easy to walk through). The real data happens to have 1 to 4 dot-separated parts of different length and has 2200 records in total. My actual goal is to fill in the set of 4 QComboBox'es with this data, in manner that the 1st QComboBox is filled with first set items ['one', 'five', 'twelve'] (no duplicates). Then depending on the chosen item, the 2nd QComboBox is filled with its related items: for 'one'

Add QWidget to QListWidget

纵饮孤独 提交于 2019-11-29 01:22:14
问题 I am trying to make a QListWidget in which each item is a simple widget that contains text and a pushbutton. I use the following: itemN = QtGui.QListWidgetItem() #Create widget widget = QtGui.QWidget() widgetText = QtGui.QLabel("I love PyQt!") widgetButton = QtGui.QPushButton("Push Me") widgetLayout = QtGui.QHBoxLayout() widgetLayout.addWidget(widgetText) widgetLayout.addWidget(widgetButton) widgetLayout.addStretch() widget.setLayout(widgetLayout) #Add widget to QListWidget funList funList

What are the mechanics of the default delegate for item views in Qt?

∥☆過路亽.° 提交于 2019-11-29 00:14:13
Short version What is the default delegate used by QTreeView ? In particular I am trying to find its paint() method? Longer version I am a Python user (Pyside/PyQt), and am using a custom delegate to recreate some of the functionality of QTreeView . Hence, I am trying to find the default delegate, and paint method, that is used in a QTreeView . Even better would be an explanation of how it works. Cross post I posted the same question at Qt Centre ( http://www.qtcentre.org/threads/64458-Finding-default-delegate-for-QTreeView ?). tl;dr The default delegate for all item views is the

How do i resize the contents of a QScrollArea as more widgets are placed inside

孤人 提交于 2019-11-28 23:05:17
I have a QScrollArea Widget, which starts empty; It has a vertical layout, with a QGridLayout, and a vertical spacer to keep it at the top, and prevent it from stretching over the whole scroll area; Elsewhere in the program, there is a QTextEdit, which when changed, has its contents scanned for "species" elements, and then they are added to the QGridLayout. Any species elements which have been removed are removed too. This bit works; I have turned the vertical scrollbar on all the time, so that when it appears it does not sit on top of the other stuff in there. Note that the scroll bar is