def delete_file(self): dialog = ProgressDialog(_('Deleting...'), indeterminate=True) dialog.show() self.item.files.delete() dialog.hide() if self.menuw: self.menuw.delete_submenu(True, True)
def configure(): # ... # main.py import app import dialog app.configure() dialog.configure() dialog.show()
def show(): # ... ############################################## # app.py import dialog class Prefs(object): # ... def get(self, name): # ... prefs = Prefs() dialog.show()
# main.py import app import dialog app.configure() dialog.configure() dialog.show()
# Copyright 2014 Brett Slatkin, Pearson Education Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Preamble to mimick book environment import logging from pprint import pprint from sys import stdout as STDOUT # Example 12 import dialog class Prefs(object): def get(self, name): pass prefs = Prefs() dialog.show()
def show_message(self, message): dialog = MessageDialog(message) skin = skins.osd.get_definition('overlay_message') if skin: dialog.skin = skin dialog.show()
def show_modal_dialog(self, dialog): dialog.setLocation(self.getLocation().x + 50, self.getLocation().y + 50) dialog.modal = 1 dialog.pack() dialog.show()
# -*- coding: utf-8 -*- import sys from PyQt5 import QtCore as Qc, QtGui as Qg, QtWidgets as Qw #(補足1) from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QDialog import dialog #デザイナーで作った画面をインポートする class MyDialog(QDialog): def __init__(self, parent=None): #クラスの初期化 super(MyDialog, self).__init__(parent) self.ui = dialog.Ui_Dialog() #先ほど作ったhello.pyの中にあるクラスの self.ui.setupUi(self) #このコマンドを実行する def MyFunc(self): self.ui.lblMyFunc.setText('MyFunc押下') if __name__ == '__main__': app = Qw.QApplication(sys.argv) #パラメータは正しくはコマンドライン引数を与える dialog = MyDialog() #MyFormのインスタンスを作って dialog.show() #表示する sys.exit(dialog.exec_()) #こうやって終了コードを渡して抜けるのが礼儀