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


Groups > comp.lang.python > #25187

Re: [newbie] Python and Qt4 Designer

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <vincent.vandevyvre@swing.be>
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:: [': 0.03; 'subject:Python': 0.05; 'none,': 0.05; 'sys': 0.05; 'url:launchpad': 0.05; '"__main__":': 0.07; '-*-': 0.07; '__name__': 0.07; 'try:': 0.07; 'utf-8': 0.07; 'python': 0.09; 'buttons': 0.09; 'coding:': 0.09; 'advance': 0.10; 'def': 0.10; 'skip:f 30': 0.15; 'from:addr:swing.be': 0.16; 'from:addr:vincent.vandevyvre': 0.16; 'from:name:vincent vande vyvre': 0.16; 'lambda': 0.16; 'message-id:@swing.be': 0.16; 'oqapy': 0.16; 'paqager': 0.16; 'qarte+7': 0.16; 'received:80.12.204': 0.16; 'received:80.12.204.220': 0.16; 'received:meplus.info': 0.16; 'received:mobistar.be': 0.16; 'received:smtp-out.mobistar.be': 0.16; 'skip:q 30': 0.16; 'url:oqapy': 0.16; 'url:paqager': 0.16; 'url:qarte': 0.16; 'v.v.': 0.16; 'wrote:': 0.17; 'subject:] ': 0.19; 'app': 0.19; 'changes': 0.20; 'trying': 0.21; 'import': 0.21; '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; 'class': 0.29; "i'm": 0.29; 'received:(smtp server)': 0.30; 'code': 0.31; 'file': 0.32; 'skip:s 30': 0.33; 'anyone': 0.33; 'to:addr:python-list': 0.33; 'thanks': 0.34; 'open': 0.35; 'add': 0.36; 'except': 0.36; 'closing': 0.36; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'skip:u 10': 0.60; 'save': 0.61; '20,': 0.65; 'button.': 0.65; 'jul': 0.65; 'received:80.12': 0.65; 'url:co': 0.66; 'received:info': 0.69; 'clicking': 0.75
X-ME-UUID 20120712005904500.7A3C0A0000EE@mwinf8112.mobistar.be
X-ME-bounce-domain mobistarmail.be
Date Thu, 12 Jul 2012 02:59:11 +0200
From Vincent Vande Vyvre <vincent.vandevyvre@swing.be>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1
MIME-Version 1.0
To python-list@python.org
Subject Re: [newbie] Python and Qt4 Designer
References <63ac761b-a0a2-4d77-a3ca-f93069fab82a@s1g2000vbj.googlegroups.com>
In-Reply-To <63ac761b-a0a2-4d77-a3ca-f93069fab82a@s1g2000vbj.googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
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>
Newsgroups comp.lang.python
Message-ID <mailman.2020.1342055147.4697.python-list@python.org> (permalink)
Lines 80
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1342055147 news.xs4all.nl 6963 [2001:888:2000:d::a6]:35614
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25187

Show key headers only | View raw


On 11/07/12 17:37, Jean Dubois wrote:
> I'm trying to combine python-code made with QT4 designer with plain
> python statements like
> file = open("test","w")
> Can anyone tell me what I have to  add to the following code just to
> open a file when clicking on the load-button and closing it by
> clicking on the save button.
>
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
>
> # Form implementation generated from reading ui file 'test.ui'
> #
> # Created: Wed Jul 11 17:21:35 2012
> #      by: PyQt4 UI code generator 4.8.3
> #
> # WARNING! All changes made in this file will be lost!
>
> from PyQt4 import QtCore, QtGui
>
> try:
>     _fromUtf8 = QtCore.QString.fromUtf8
> except AttributeError:
>     _fromUtf8 = lambda s: s
>
> class Ui_Form(object):
>     def setupUi(self, Form):
>         Form.setObjectName(_fromUtf8("Form"))
>         Form.resize(400, 300)
>         self.widget = QtGui.QWidget(Form)
>         self.widget.setGeometry(QtCore.QRect(10, 20, 146, 25))
>         self.widget.setObjectName(_fromUtf8("widget"))
>         self.horizontalLayout = QtGui.QHBoxLayout(self.widget)
>         self.horizontalLayout.setMargin(0)
>  
> self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
>         self.pushButton_2 = QtGui.QPushButton(self.widget)
>         self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
>         self.horizontalLayout.addWidget(self.pushButton_2)
>         self.pushButton = QtGui.QPushButton(self.widget)
>         self.pushButton.setObjectName(_fromUtf8("pushButton"))
>         self.horizontalLayout.addWidget(self.pushButton)
>
>         self.retranslateUi(Form)
>         QtCore.QMetaObject.connectSlotsByName(Form)
>
>     def retranslateUi(self, Form):
>         Form.setWindowTitle(QtGui.QApplication.translate("Form",
> "Form", None, QtGui.QApplication.UnicodeUTF8))
>         self.pushButton_2.setText(QtGui.QApplication.translate("Form",
> "Save file", None, QtGui.QApplication.UnicodeUTF8))
>         self.pushButton.setText(QtGui.QApplication.translate("Form",
> "Load file", None, QtGui.QApplication.UnicodeUTF8))
>
>
> if __name__ == "__main__":
>     import sys
>     app = QtGui.QApplication(sys.argv)
>     Form = QtGui.QWidget()
>     ui = Ui_Form()
>     ui.setupUi(Form)
>     Form.show()
>     sys.exit(app.exec_())
>
>
> thanks in advance
> jean
Connect the signal clicked of your's buttons to your's functions.

    self.pushButton.clicked.connect(self.my_func)

Here's all the truth:
   
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/new_style_signals_slots.html

-- 
Vincent V.V.
Oqapy <https://launchpad.net/oqapy> . Qarte+7
<https://launchpad.net/qarte+7> . PaQager <https://launchpad.net/paqager>

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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