Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #25293

Re: Python and Qt4 Designer

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <jeandubois314@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'none,': 0.05; 'sys': 0.05; 'url:launchpad': 0.05; '-*-': 0.07; '__name__': 0.07; 'try:': 0.07; 'utf-8': 0.07; 'python': 0.09; 'buttons': 0.09; 'coding:': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'advance': 0.10; 'def': 0.10; '&gt;&gt;': 0.16; 'folder.': 0.16; 'lambda': 0.16; 'oqapy': 0.16; 'paqager': 0.16; 'qarte+7': 0.16; 'skip:f 60': 0.16; 'skip:q 30': 0.16; 'started?': 0.16; 'url:oqapy': 0.16; 'url:paqager': 0.16; 'url:qarte': 0.16; 'v.v.': 0.16; 'wrote:': 0.17; '&lt;': 0.17; 'examples': 0.18; 'app': 0.19; 'changes': 0.20; 'trying': 0.21; 'import': 0.21; '&gt;&gt;&gt;': 0.22; 'skip:s 70': 0.22; 'url:gt': 0.22; 'cc:2**0': 0.23; 'example': 0.23; '&gt;': 0.23; 'references': 0.23; 'cc:no real name:2**0': 0.24; 'machine': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'plain': 0.27; 'skip:# 10': 0.27; 'designer': 0.27; 'functions.': 0.27; 'skip:s 60': 0.27; 'clicked': 0.29; 'jean': 0.29; 'skip:q 20': 0.29; 'statements': 0.29; 'skip:& 10': 0.29; 'class': 0.29; "i'm": 0.29; 'install': 0.29; 'connection': 0.30; 'located': 0.31; 'code': 0.31; 'file': 0.32; 'could': 0.32; 'skip:s 30': 0.33; 'function.': 0.33; 'anyone': 0.33; 'skip:& 20': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'skip:f 40': 0.35; 'open': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'add': 0.36; 'except': 0.36; 'closing': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'url:docs': 0.38; 'end': 0.40; 'your': 0.60; 'skip:u 10': 0.60; 'save': 0.61; 'more': 0.63; '20,': 0.65; 'button.': 0.65; 'jul': 0.65; 'url:co': 0.66; 'clicking': 0.75; 'site:': 0.84; 'received:209.85.220.184': 0.91; 'skip:/ 30': 0.91
Newsgroups comp.lang.python
Date Fri, 13 Jul 2012 14:12:57 -0700 (PDT)
In-Reply-To <mailman.2060.1342144373.4697.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=91.182.5.186; posting-account=-4q5ZAoAAABqYnHiWOUEwtub4CGC9qTi
References <63ac761b-a0a2-4d77-a3ca-f93069fab82a@s1g2000vbj.googlegroups.com> <mailman.2020.1342055147.4697.python-list@python.org> <b6a17f2f-1653-4c4e-a50e-af13c1eabcd7@n16g2000vbn.googlegroups.com> <mailman.2060.1342144373.4697.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 91.182.5.186
MIME-Version 1.0
Subject Re: Python and Qt4 Designer
From Jean Dubois <jeandubois314@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.2104.1342213980.4697.python-list@python.org> (permalink)
Lines 102
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1342213980 news.xs4all.nl 6931 [2001:888:2000:d::a6]:45815
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25293

Show key headers only | View raw


Op vrijdag 13 juli 2012 03:52:51 UTC+2 schreef Vincent Vande Vyvre het volgende:
> On 12/07/12 08:42, Jean Dubois wrote:
> &gt; On 12 jul, 02:59, Vincent Vande Vyvre &lt;vincent.vandevy...@swing.be&gt;
> &gt; wrote:
> &gt;&gt; On 11/07/12 17:37, Jean Dubois wrote:
> &gt;&gt;
> &gt;&gt;
> &gt;&gt;
> &gt;&gt;
> &gt;&gt;
> &gt;&gt;
> &gt;&gt;
> &gt;&gt;&gt; I&#39;m trying to combine python-code made with QT4 designer with plain
> &gt;&gt;&gt; python statements like
> &gt;&gt;&gt; file = open(&quot;test&quot;,&quot;w&quot;)
> &gt;&gt;&gt; Can anyone tell me what I have to  add to the following code just to
> &gt;&gt;&gt; open a file when clicking on the load-button and closing it by
> &gt;&gt;&gt; clicking on the save button.
> &gt;&gt;&gt; #!/usr/bin/env python
> &gt;&gt;&gt; # -*- coding: utf-8 -*-
> &gt;&gt;&gt; # Form implementation generated from reading ui file &#39;test.ui&#39;
> &gt;&gt;&gt; #
> &gt;&gt;&gt; # Created: Wed Jul 11 17:21:35 2012
> &gt;&gt;&gt; #      by: PyQt4 UI code generator 4.8.3
> &gt;&gt;&gt; #
> &gt;&gt;&gt; # WARNING! All changes made in this file will be lost!
> &gt;&gt;&gt; from PyQt4 import QtCore, QtGui
> &gt;&gt;&gt; try:
> &gt;&gt;&gt;     _fromUtf8 = QtCore.QString.fromUtf8
> &gt;&gt;&gt; except AttributeError:
> &gt;&gt;&gt;     _fromUtf8 = lambda s: s
> &gt;&gt;&gt; class Ui_Form(object):
> &gt;&gt;&gt;     def setupUi(self, Form):
> &gt;&gt;&gt;         Form.setObjectName(_fromUtf8(&quot;Form&quot;))
> &gt;&gt;&gt;         Form.resize(400, 300)
> &gt;&gt;&gt;         self.widget = QtGui.QWidget(Form)
> &gt;&gt;&gt;         self.widget.setGeometry(QtCore.QRect(10, 20, 146, 25))
> &gt;&gt;&gt;         self.widget.setObjectName(_fromUtf8(&quot;widget&quot;))
> &gt;&gt;&gt;         self.horizontalLayout = QtGui.QHBoxLayout(self.widget)
> &gt;&gt;&gt;         self.horizontalLayout.setMargin(0)
> &gt;&gt;&gt; self.horizontalLayout.setObjectName(_fromUtf8(&quot;horizontalLayout&quot;))
> &gt;&gt;&gt;         self.pushButton_2 = QtGui.QPushButton(self.widget)
> &gt;&gt;&gt;         self.pushButton_2.setObjectName(_fromUtf8(&quot;pushButton_2&quot;))
> &gt;&gt;&gt;         self.horizontalLayout.addWidget(self.pushButton_2)
> &gt;&gt;&gt;         self.pushButton = QtGui.QPushButton(self.widget)
> &gt;&gt;&gt;         self.pushButton.setObjectName(_fromUtf8(&quot;pushButton&quot;))
> &gt;&gt;&gt;         self.horizontalLayout.addWidget(self.pushButton)
> &gt;&gt;&gt;         self.retranslateUi(Form)
> &gt;&gt;&gt;         QtCore.QMetaObject.connectSlotsByName(Form)
> &gt;&gt;&gt;     def retranslateUi(self, Form):
> &gt;&gt;&gt;         Form.setWindowTitle(QtGui.QApplication.translate(&quot;Form&quot;,
> &gt;&gt;&gt; &quot;Form&quot;, None, QtGui.QApplication.UnicodeUTF8))
> &gt;&gt;&gt;         self.pushButton_2.setText(QtGui.QApplication.translate(&quot;Form&quot;,
> &gt;&gt;&gt; &quot;Save file&quot;, None, QtGui.QApplication.UnicodeUTF8))
> &gt;&gt;&gt;         self.pushButton.setText(QtGui.QApplication.translate(&quot;Form&quot;,
> &gt;&gt;&gt; &quot;Load file&quot;, None, QtGui.QApplication.UnicodeUTF8))
> &gt;&gt;&gt; if __name__ == &quot;__main__&quot;:
> &gt;&gt;&gt;     import sys
> &gt;&gt;&gt;     app = QtGui.QApplication(sys.argv)
> &gt;&gt;&gt;     Form = QtGui.QWidget()
> &gt;&gt;&gt;     ui = Ui_Form()
> &gt;&gt;&gt;     ui.setupUi(Form)
> &gt;&gt;&gt;     Form.show()
> &gt;&gt;&gt;     sys.exit(app.exec_())
> &gt;&gt;&gt; thanks in advance
> &gt;&gt;&gt; jean
> &gt;&gt; Connect the signal clicked of your&#39;s buttons to your&#39;s functions.
> &gt;&gt;
> &gt;&gt;     self.pushButton.clicked.connect(self.my_func)
> &gt;&gt;
> &gt;&gt; Here&#39;s all the truth:
> &gt;&gt;
> &gt;&gt; http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/new_style_...
> &gt;&gt;
> &gt;&gt; --
> &gt;&gt; Vincent V.V.
> &gt;&gt; Oqapy &lt;https://launchpad.net/oqapy&gt; . Qarte+7
> &gt;&gt; &lt;https://launchpad.net/qarte+7&gt; . PaQager &lt;https://launchpad.net/paqager&gt;
> &gt; thanks for the reference, could you just supply a small example for
> &gt; the code above to get me started?
> &gt;
> &gt; thanks in advance
> &gt; jean
> Just add the connection at the end of the Ui_Form class and, of course,
> your function.
> 
> You can find numbers of examples in your PyQt4 install folder.
> On my machine is located at /usr/share/doc/python-qt4-doc/examples
> 
> And, for more inspiration, have a look at this site:
>    http://diotavelli.net/PyQtWiki/
> 
> -- 
> Vincent V.V.
> Oqapy &lt;https://launchpad.net/oqapy&gt; . Qarte
> &lt;https://launchpad.net/qarte&gt; . PaQager &lt;https://launchpad.net/paqager&gt;

Thanks for the extra docu references

regards,

jean

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[newbie] Python and Qt4 Designer Jean Dubois <jeandubois314@gmail.com> - 2012-07-11 08:37 -0700
  Re: [newbie] Python and Qt4 Designer Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2012-07-12 02:59 +0200
    Re: Python and Qt4 Designer Jean Dubois <jeandubois314@gmail.com> - 2012-07-11 23:42 -0700
      Re: Python and Qt4 Designer Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2012-07-13 03:52 +0200
        Re: Python and Qt4 Designer Jean Dubois <jeandubois314@gmail.com> - 2012-07-13 14:12 -0700
          Re: Python and Qt4 Designer Michael Torrie <torriem@gmail.com> - 2012-07-14 08:45 -0600
            Re: Python and Qt4 Designer rusi <rustompmody@gmail.com> - 2012-07-14 10:13 -0700
              Re: Python and Qt4 Designer Michael Torrie <torriem@gmail.com> - 2012-07-14 23:31 -0600
              Re: Python and Qt4 Designer Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2012-07-15 09:58 +0200
              Re: Python and Qt4 Designer Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-07-15 08:42 -0400
              Re: Python and Qt4 Designer Michael Torrie <torriem@gmail.com> - 2012-07-16 07:56 -0600
              Re: Python and Qt4 Designer Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-07-16 13:07 -0400
        Re: Python and Qt4 Designer Jean Dubois <jeandubois314@gmail.com> - 2012-07-13 14:12 -0700

csiph-web