Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7025271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:57:08+00:00 2026-05-27T23:57:08+00:00

I have a form and a popup form as given below (partial code): import

  • 0

I have a form and a popup form as given below (partial code):

import sys
import subprocess
import os
from PyQt4 import QtCore, QtGui
from ui_auto import Ui_Form
from popup_ui import Ui_Form as fm

class MyPopupForm(QtGui.QWidget):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = fm()
        self.ui.setupUi(self)
class MyForm(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_Form()
        self.ui.setupUi(self)
    def when_pressed(self):
         self.mypopup=MyPopupForm()
         self.mypopup.show()
    def when_stopped(self):
         self.mypopup=MyPopupForm()
         self.mypopup.show()

Myform is my main form and MyPopupForm is the popup form. I need to do in such a way that, when I press a button it will print some string and display that string. When I press another button i have to invoke the same form but with different string. How could I do that (I used Qtdesigner to create UI)

MyPopupForm code in python:

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'popup.ui'
#
# Created: Sun Jan  8 11:18:43 2012
#      by: PyQt4 UI code generator 4.7.3
#
# WARNING! All changes made in this file will be lost!

from PyQt4 import QtCore, QtGui

class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(207, 170)
        self.pushButton = QtGui.QPushButton(Form)
        self.pushButton.setGeometry(QtCore.QRect(60, 120, 92, 27))
        self.pushButton.setObjectName("pushButton")
        self.label = QtGui.QLabel(Form)
        self.label.setGeometry(QtCore.QRect(58, 30, 81, 41))
        #self.label.setText("")
        self.label.setObjectName("label")

        self.retranslateUi(Form)
        QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL("clicked()"), Form.close)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
        self.pushButton.setText(QtGui.QApplication.translate("Form", "OK", None, QtGui.QApplication.UnicodeUTF8))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:57:09+00:00Added an answer on May 27, 2026 at 11:57 pm

    The simplest way is to add a parameter to the __init__ method of the class MyPopupForm

    def __init__(self, string_to_be_passed=None, parent=None):

    and then when you call it with

    self.mypopup=MyPopupForm("value_to_display")

    using the string_to_be_passed in the __init__ method to display the value.

    Another method is to add a method to the class MyPopupForm to set the string to display and then

    self.mypopup=MyPopupForm()
    self.mypopup.setValueToDisplay("value")
    self.mypopup.show()
    

    with the setValueToDisplay() that display the string where needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a webpage with a form element and a popup window (opened by
We are using OC4J 10.1.3.5 and ADF. I have a popup form and when
I have a form in my jsf page(a popup) that I used to upload
I have a form which one of it's fields is a code and description,
I have a popup form with 4 textboxes, all of which have default values
I have a ASPxGridView with a popup edit form which contains another ASPxGridView. When
I have a form that is displayed in a popup. After loading, the background
I have a simple form like below that I have added the jQuery validations
I have a form that calls a success message with this code: // Form
I have a pop up form that i wish to close on successfull submit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.