lwc:programming:python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
lwc:programming:python [2020/11/26 22:40] – created John Harrisonlwc:programming:python [2022/12/30 11:58] (current) John Harrison
Line 7: Line 7:
  
 ==== Example: ==== ==== Example: ====
 + * Assume "worker" is the instance of controller class. Then in the view class:
 +<code>
 +self.worker.showDialog.connect(self.showIntroWindow)
 +</code>
  
-Assume "worker" is the instance of controller class. 
- 
-Then in the view class: 
- 
- 
-<HTML><blockquote> 
-self.worker.showDialog.connect(self.showIntroWindow) 
-</blockquote></HTML> 
 will connect the signal showDialog defined in worker such that when data is emited to showDialog, the method called showIntroWindow in the view class will be called. will connect the signal showDialog defined in worker such that when data is emited to showDialog, the method called showIntroWindow in the view class will be called.
  
Line 21: Line 17:
  
      showDialog = QtCore.pyqtSignal(object)      showDialog = QtCore.pyqtSignal(object)
- 
  
 Note that the view class does not reference any methods in the controller class Note that the view class does not reference any methods in the controller class
  
 Then when the controller class wants to change the view it does something like: Then when the controller class wants to change the view it does something like:
- 
  
      self.showDialog.emit(True)      self.showDialog.emit(True)
- 
- 
  
 And the view class will receive this in methodshowIntroWindow which will at that point be called. And the view class will receive this in methodshowIntroWindow which will at that point be called.
Line 40: Line 32:
 So in our example, state = True So in our example, state = True
  
-\\ +===== Reference ===== 
- +  * [[https://mkaz.blog/code/python-string-format-cookbook/|string format cookbook]]
- +
- +
- +
- +
  • lwc/programming/python.1606452033.txt.gz
  • Last modified: 2020/11/26 22:40
  • by John Harrison