14_Parent_Child

合集下载

nth-child用法

nth-child用法

在CSS中,nth-child是一个伪类选择器,用于选择指定父元素下的特定位置的子元素。

nth-child的语法如下:
:nth-child(an+b)
其中,`an+b`是一个公式,n表示子元素的位置,a和b是常数。

下面是一些常见的用法示例:
1. 选择特定位置的子元素:
- `:nth-child(1)`:选择第一个子元素。

- `:nth-child(2)`:选择第二个子元素。

- `:nth-child(odd)`:选择奇数位置的子元素。

- `:nth-child(even)`:选择偶数位置的子元素。

2. 选择一定范围的子元素:
- `:nth-child(n)`:选择所有子元素。

- `:nth-child(n+4)`:选择从第4个子元素开始的所有子元素。

- `:nth-child(-n+3)`:选择前3个子元素。

3. 使用公式进行选择:
- `:nth-child(2n)`:选择所有偶数位置的子元素。

- `:nth-child(3n+1)`:选择所有位置除以3余数为1的子元素。

注意事项:
- nth-child从1开始计数。

- nth-child选择器将应用于匹配子元素的父元素。

- 如果没有匹配的子元素,选择器不会选中任何元素。

- nth-child选择器还可以与其他选择器(如类选择器、标签选择器)组合使用,以选择更具体的元素。

child_process用法

child_process用法

一、child_process简介child_process是Node.js中的一个核心模块,用于创建子进程并与其进行交互。

在Node.js中,单线程的特性可能导致处理并行任务时出现阻塞的情况,而通过child_process模块,可以创建新的进程来处理并行任务,从而提高应用程序的性能和响应速度。

二、child_process的常见用法1. 使用exec()方法exec方法用于执行命令并获取其输出。

使用该方法时,需要传入一个要执行的命令,并且可以指定一些参数选项。

下面是一个简单的示例:```javascriptconst { exec } = require('child_process');exec('ls -l', (error, stdout, stderr) => {if (error) {console.error(`exec error: ${error}`);return;}console.log(`stdout: ${stdout}`);console.error(`stderr: ${stderr}`);});```在上面的示例中,我们使用exec方法执行了ls -l命令,并在回调函数中处理了输出的结果。

2. 使用spawn()方法spawn方法用于创建新的进程并执行指定的命令。

与exec方法不同的是,spawn方法返回一个流对象,可以通过监听事件的方式来获取命令执行的结果。

以下是一个示例:```javascriptconst { spawn } = require('child_process');const ls = spawn('ls', ['-l']);ls.stdout.on('data', (data) => {console.log(`stdout: ${data}`);});ls.stderr.on('data', (data) => {console.error(`stderr: ${data}`);});ls.on('close', (code) => {console.log(`child process exited with code ${code}`);});```在上面的示例中,我们使用spawn方法创建了一个新的进程,并执行了ls -l命令。

parent拆分单词

parent拆分单词

parent拆分单词“parent”可以拆分为:“p”“a”“r”“e”“n”“t”,不过这种拆分没有实际意义上单独字母组合的特殊含义,这里主要从整个单词的角度来看。

一、单词释义1. 作名词时,“parent”的意思是“父亲(或母亲);(动、植物的)亲本,母体”。

例如,A single parent has to do everything alone.(单亲得独自做所有的事,这里的“parent”指父亲或者母亲,体现出单亲家长的不易,有一种同情的情绪在里面。

)2. 作动词时,“parent”表示“做……的父亲(或母亲);养育(子女);引起(某事物)”。

例如,They parented three children.(他们养育了三个孩子,简单直接地表达养育孩子这个动作。

)二、单词用法1. 作为可数名词,复数形式是“parents”,表示“父母;双亲”。

例如,My parents are very strict.(我的父母非常严格,这是很常见的表达自己父母特点的句子。

)2. 在句子中可以作主语、宾语等。

例如,The parents love their children deeply.(父母深爱他们的孩子,这里“parents”作主语。

)3. 当表示单亲时,可以用“single parent”这个短语。

例如,Many single parents struggle to make ends meet.(许多单亲家长努力维持生计,“single parent”作主语,反映出单亲家长面临的经济压力,有一种无奈的情绪。

)三、近义词1. father/mother:更具体地指父亲或者母亲。

例如,My father is like a big tree in my family.(我的父亲在我家就像一棵大树,使用了隐喻,把父亲比作大树,很形象地表达出父亲的重要性。

)对比“parent”,“father/mother”指向更明确。

JS获取子节点父节点和兄弟节点的方法实例总结

JS获取子节点父节点和兄弟节点的方法实例总结

JS获取子节点父节点和兄弟节点的方法实例总结一、获取子节点1、使用childNodes属性childNodes属性用于返回指定节点的子节点集合。

该函数定义如下:node.childNodes这个集合不仅包含元素节点,还包含文本节点和注释节点。

我们要想获取只是元素节点,就要使用children属性了。

2、使用children属性children属性,用于返回指定节点的子元素集合,不会返回文本节点和注释节点。

函数定义如下:node.children3、使用getElementsByTagNametag.getElementsByTagName(tagName)4、使用querySelectorAllquerySelectorAll(为CSS3新增API,用于获取符合指定CSS选择符的元素集合,函数定义如下:element.querySelectorAll(selector)二、获取父节点1、使用parentNode属性parentNode属性,用于返回指定节点的父节点,该函数定义如下:node.parentNode2、使用parentElement属性parentElement属性,用于返回指定节点的父元素,这里要注意:parentElement只会返回父元素,它一定不会返回文本节点,函数定义如下:node.parentElement3、使用offsetParent属性offsetParent属性,用于返回一个指定元素的第一个定位元素。

一般来说,块级元素的offsetParent是定位在它的父元素,而行内元素的offsetParent是定位在它的body元素上。

函数定义如下:node.offsetParent三、获取兄弟节点1、使用previousSibling属性previousSibling属性,用于返回指定节点的上一个相邻节点。

xpath——父子、兄弟、相邻节点定位方式详解

xpath——父子、兄弟、相邻节点定位方式详解

xpath——⽗⼦、兄弟、相邻节点定位⽅式详解转载最后发布于2019-06-15 20:47:17 阅读数 1215 收藏1. 由⽗节点定位⼦节点最简单的肯定就是由⽗节点定位⼦节点了,我们有很多⽅法可以定位,下⾯上个例⼦:对以下代码:1.<html>2.<body>3.<div id="A">4.<!--⽗节点定位⼦节点-->5.<div id="B">6.<div>parent to child</div>7.</div>8.</div>9.</body>10.</html>1想要根据 B节点定位⽆id的⼦节点,代码⽰例如下:1.# -*- coding: utf-8 -*-2.from selenium import webdriver3.4.driver = webdriver.Firefox()5.driver.get('D:\\py\\AutoTestFramework\\src\\others\\test.html')6.7.# 1.串联寻找8.print driver.find_element_by_id('B').find_element_by_tag_name('div').text9.10.# 2.xpath⽗⼦关系寻找11.print driver.find_element_by_xpath("//div[@id='B']/div").text12.13.# 3.css selector⽗⼦关系寻找14.print driver.find_element_by_css_selector('div#B>div').text15.16.# 4.css selector nth-child17.print driver.find_element_by_css_selector('div#B div:nth-child(1)').text18.19.# 5.css selector nth-of-type20.print driver.find_element_by_css_selector('div#B div:nth-of-type(1)').text21.22.# 6.xpath轴 child23.print driver.find_element_by_xpath("//div[@id='B']/child::div").text24.25.driver.quit()1结果:1.parent to child2.parent to child3.parent to child4.parent to child5.parent to child6.parent to child1第1到第3都是我们熟悉的⽅法,便不再多⾔。

parent-child relationship.

parent-child relationship.

BOOK1
Unit2
5) Millennial Generation Born 1982 to 2003 This is the generation where the “Class of 2000” is born. This new generation is being treated as precious. This is the generation of hope, hope to correct the errors of their parents.
BOOK1
Unit2
1. What is Generation Gap?
Generational division and conflict have always been part of human society. The Bible recognized that often sharp disagreements existed across generations characterizing one as “ a stubborn ( 固执的 ) and rebellious ( 叛逆的 ) generation ” (Psalms (《圣歌》)) and another as “a very forward (刚愎的) generation, children in who is no faith” (Deuteronomy (《圣经》中的《申命记 》)).
BOOK1
Unit2
General/ Issue Government
1) G.I. Generation Born 1901 to 1924
They learned early in life on Members of G.I. Generation how to be a good team player, are high achiever, fearless but putting their trust in not reckless, patriotic, idealistic, government, authority and and morally conscientious. community.

200个家庭的英文单词名词

200个家庭的英文单词名词

200个家庭的英文单词名词1. Family2. House3. Parent4. Child5. Sibling6. Grandparent7. Cousin8. Aunt9. Uncle10. Nephew11. Niece12. Spouse13. In-law14. Relative15. Home16. Pet17. Baby18. Toddler19. Teenager20. Adult21. Parenting22. Household23. Marriage24. Divorce25. Adoption26. Orphan27. Orphanage28. Foster care29. Stepfamily30. Extended family31. Kinship32. Genealogy33. Ancestor34. Descendant35. Fatherhood36. Motherhood37. Parenthood38. Childhood39. Grandchild40. Grandmother41. Grandfather42. Brother43. Sister44. Half-sibling45. Step-sibling46. Twin47. Triplet48. Son49. Daughter50. Bride51. Groom52. Bridegroom53. Parents-in-law54. Sibling-in-law55. Cousin-in-law56. Godfather57. Godmother58. Godson59. Goddaughter60. Maternal61. Paternal62. Foster parent63. Step-parent64. Stepson65. Stepdaughter66. Stepmother67. Stepfather68. Legal guardian69. Child support70. Sole custody71. Joint custody72. Custody battle73. Inheritance74. Family reunion75. Family tree76. Family values77. Family traditions78. Housewarming79. Homemaker80. Breadwinner81. Working parent82. Stay-at-home parent83. Empty nest84. Foster child85. Adoptive parent86. Single parent87. Blended family88. Nuclear family89. Traditional family90. Same-sex parents91. Transgender parent92. Parents' rights93. Foster home94. Homeless shelter95. Family planning96. Domestic violence97. Child abuse98. Parental guidance99. School-age child 100. Special needs child 101. Big brother 102. Big sister103. Baby sister104. Baby brother 105. Only child106. Youngest child 107. Oldest child 108. Middle child 109. Grandson110. Bachelor111. Household chores 112. Family support 113. Family therapy 114. Family dynamics 115. Family culture 116. Family history 117. Kinship system 118. Parenting style 119. Family unit121. Family values122. Family responsibilities 123. Family hierarchy 124. Family customs125. Family likeness126. Family gathering 127. Family outing128. Family vacation129. Family memories 130. Family photo131. Family album132. Family heirloom 133. Family tradition134. Family heritage135. Family celebration 136. Family dinner137. Family meal138. Family holiday139. Family function140. Family bond141. Family relationship 142. Family connection 143. Family love144. Family happiness 145. Family support146. Family time147. Family project148. Family decision-making 149. Family affiliates151. Family name152. Family history153. Family story154. Family genealogy 155. Family background 156. Family reunion 157. Family tree158. Family member 159. Family ties160. Family gene161. Family values162. Family traditions 163. Family culture164. Family rituals165. Family roles166. Family expectations 167. Family dynamics 168. Family structure 169. Family responsibilities 170. Family bond171. Family support 172. Family relationships 173. Family connection 174. Family love175. Family happiness 176. Family unity177. Family unity178. Family strength 179. Family growth180. Family home181. Family activities 182. Family welfare183. Family health184. Family budget185. Family income186. Family needs187. Family problems 188. Family conflicts 189. Family stress190. Family communication 191. Family harmony 192. Family education 193. Family values194. Family ethics195. Family responsibility 196. Family law197. Family therapy198. Family counseling 199. Family planning 200. Family well-being。

Pyqt中__init__(self,parent==None)parent理解

Pyqt中__init__(self,parent==None)parent理解

Pyqt中__init__(self,parent==None)parent理解参考:在PyQt中,所有class都是从QObject派⽣⽽来,QWidget对象就可以有⼀个parent。

这种parent-child关系主要⽤于两个⽅⾯:1. 没有parent的QWidget类被认为是最上层的窗体(通常是MainWindow),由于MainWindow的⼀些操作⽣成的新窗体对象,parent都应该指向MainWindow。

2. 由于parent-child关系的存在,它保证了child窗体在主窗体被回收之时也被回收。

parent作为构造函数的最后⼀个参数被传⼊,但通常情况下不必显⽰去指定parent对象。

因为当调⽤局管理器时,部局管理器会⾃动处理这种parent-child关系。

但是在⼀些特殊的情况下,我们必须显⽰的指定parent-child关系。

如当⽣成的⼦类不是QWidget对象但继承了QObject 对象,⽤作dock widgets的QWidget对象。

我们可以看到,对象之间有了依赖和⽣命周期,把IOC容器运⽤到GUI编程中是⾃然⽽然的事情了。

参考来⾃:⽰例说明:新建三个⽂件,分别为 calc.ui 、 calc_logic.py 、 main.py 其中:calc.ui 为Ui设计⽂件, 需要转换为calc.pycalc_logic.py 是calc的实现逻辑部分main.py 是项⽬的主⼊⼝⽂件calc.ui1<?xml version="1.0" encoding="UTF-8"?>2<ui version="4.0">3<class>calc</class>4<widget class="QWidget" name="calc">5<property name="geometry">6<rect>7<x>0</x>8<y>0</y>9<width>400</width>10<height>300</height>11</rect>12</property>13<property name="windowTitle">14<string>Form</string>15</property>16<widget class="QPushButton" name="pushButton_ok">17<property name="geometry">18<rect>19<x>130</x>20<y>160</y>21<width>75</width>22<height>23</height>23</rect>24</property>25<property name="text">26<string>提⽰</string>27</property>28</widget>29</widget>30<resources/>31<connections/>32</ui>我们将calc.ui 转换为calc.py⽂件1# -*- coding: utf-8 -*-23# Form implementation generated from reading ui file 'calc.ui'4#5# Created: Wed Jan 28 11:28:59 20156# by: PyQt4 UI code generator 4.10.37#8# WARNING! All changes made in this file will be lost!10from PyQt4 import QtCore, QtGui1112try:13 _fromUtf8 = QtCore.QString.fromUtf814except AttributeError:15def _fromUtf8(s):16return s1718try:19 _encoding = QtGui.QApplication.UnicodeUTF820def _translate(context, text, disambig):21return QtGui.QApplication.translate(context, text, disambig, _encoding)22except AttributeError:23def _translate(context, text, disambig):24return QtGui.QApplication.translate(context, text, disambig)2526class Ui_calc(object):27def setupUi(self, calc):28 calc.setObjectName(_fromUtf8("calc"))29 calc.resize(400, 300)30 self.pushButton_ok = QtGui.QPushButton(calc)31 self.pushButton_ok.setGeometry(QtCore.QRect(130, 160, 75, 23))32 self.pushButton_ok.setObjectName(_fromUtf8("pushButton_ok"))3334 self.retranslateUi(calc)35 QtCore.QMetaObject.connectSlotsByName(calc)3637def retranslateUi(self, calc):38 calc.setWindowTitle(_translate("calc", "Form", None))39 self.pushButton_ok.setText(_translate("calc", "提⽰", None))404142if__name__ == "__main__":43import sys44 app = QtGui.QApplication(sys.argv)45 calc = QtGui.QWidget()46 ui = Ui_calc()47 ui.setupUi(calc)48 calc.show()49 sys.exit(app.exec_())新建calc_logic.py ⽂件,⽂件内容:1# -*- coding: utf-8 -*-2from PyQt4 import QtGui, QtCore3from calc import Ui_calc # 引⼊Ui4567class calc_logic(QtGui.QWidget):8def__init__(self,parent=None):9 super(calc_logic,self).__init__(parent)10 self.Ui=Ui_calc() # 实例化 Ui11 self.Ui.setupUi(self) # 初始化Ui12 self.setWindowTitle('calc_logic Widget')1314 self.connect(self.Ui.pushButton_ok,QtCore.SIGNAL('clicked()'),self.dialogx)1516def dialogx(self):17if__name__=='__main__':18 rmation(self, (u'提⽰'),(u' 来⾃calc_logic⽂件请求! '),QtGui.QMessageBox.Yes ) 19elif__name__=='calc_logic':20 rmation(self, (u'提⽰'),(u' 来⾃main⽂件请求! '),QtGui.QMessageBox.Yes )212223if__name__ == "__main__":24import sys25 app = QtGui.QApplication(sys.argv)26 calc =calc_logic()27 calc.show()28 sys.exit(app.exec_())新建⼊⼝⽂件main.py1# -*- coding: utf-8 -*-2'''3 main 主⽂件4'''5from PyQt4 import QtGui6import sys7from calc_logic import calc_logic # 引⼊Ui的逻辑⽂件810class maincalc(QtGui.QWidget):11def__init__(self):12 super(maincalc,self).__init__()13 self.setWindowTitle('main Widget')14 self.Ui=calc_logic(self) # 实例化 calc_logic 1516171819if__name__ == "__main__":20import sys21 app = QtGui.QApplication(sys.argv)22 appcalc =maincalc()23 appcalc.show()24 sys.exit(app.exec_())我们先运⾏calc_logic.py :然后修改calc_logic.py 中__init__初试⽅法1def__init__(self,parent=None):2 super(calc_logic,self).__init__(parent)改为:1def__init__(self):2 super(calc_logic,self).__init__()修改main.py 初始化calc_logic改为:1 self.Ui=calc_logic()运⾏效果:将mian.py 改回带self参数:1 self.Ui=calc_logic(self)将clac_logic.py 同样改回带parent参数:1def__init__(self,parent=None):2 super(calc_logic,self).__init__(parent)在运⾏main.py :。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
CATIA V5:
A Division of RAND WORLDWIDE™
Introduction
Chapter 14: Parent/Child Relationships
Objectives: Establishing Parent Child Relationships Changing Parent Child Relationships Feature Failure
• Select Tools > Parent/Children in the main menu
9
Technical Education Services
A Division of RAND WORLDWIDE™
Investigating
ቤተ መጻሕፍቲ ባይዱ
• Parents and Children dialog box displays parents and children of a selected feature
2
Technical Education Services
A Division of RAND WORLDWIDE™
Establishing
This surface was selected as the sketch plane for the cylindrical pad sketch
• Selecting a sketching plane creates a parent/child relationship
The sketched line was made coincident with the surface of the pocket
5
Technical Education Services
A Division of RAND WORLDWIDE™
Establishing
• Dimensioning references to existing geometry create parent/child relationships • Note the relative coordinate values
A Division of RAND WORLDWIDE™
Changing References
• Sketch Dimensions
• can be changed by editing the sketched feature and deleting dimensions while in the Sketcher Workbench
15
Technical Education Services
A Division of RAND WORLDWIDE™
Exercise Preview

Exercise 14a: Parent Child Relationships
16
Technical Education Services
Sketch.1 is a parent to Pad.1
4
Technical Education Services
A Division of RAND WORLDWIDE™
Establishing
• Constraints in a sketch create parent/child relationships
• Sliding maintains sketch Absolute Axis orientation • Positioning allows you to change the direction of the Absolute Axis
11
Technical Education Services
10
Technical Education Services
A Division of RAND WORLDWIDE™
Changing References
• Solid geometry will follow the location of the sketch plane • Click Sketch.#object > Change Sketch Support from the pop-up menu • Sketch support can be either sliding or positioning
1
Technical Education Services
A Division of RAND WORLDWIDE™
Parent/Child Relationships
• Defined as the dependency of one feature on another • The original feature is the parent, the dependent feature is the child • Modifications to the parent feature can also affect the child feature • If the parent feature is deleted or deactivated, the child feature must be deleted, deactivated or rereferenced
• Sketcher Constraints
• can be changed by editing the sketched feature and deleting the constraints while in the Sketcher Workbench
• Depth Options
• Can be changed by editing the Pad or Pocket and selecting a different depth option reference or a different depth option
6
Technical Education Services
A Division of RAND WORLDWIDE™
Establishing
• Projected 3D geometry tools establish a parent/child relationship between the sketch and the existing geometry being projected
3
Technical Education Services
A Division of RAND WORLDWIDE™
Establishing
• Selecting a sketch creates a parent/child relationship between the sketch and the feature that uses it
14
Technical Education Services
A Division of RAND WORLDWIDE™
Feature Failure
• Options for Resolving Feature Failure
• Edit • Deactivate • Isolate • Delete
7
Technical Education Services
A Division of RAND WORLDWIDE™
Establishing
• Depth options such as Up to plane create relationships between features
Up to plane option for cylindrical pad feature
13
Technical Education Services
A Division of RAND WORLDWIDE™
Feature Failure
• If changes are made to an existing feature that result in a inconsistent solution, the Update Diagnosis dialog box appears
8
Technical Education Services
A Division of RAND WORLDWIDE™
Investigating
• The Parent/Children tool displays information on the parents and children of a selected feature • click Parent/Children from the rightmouse button pop-up menu
12
Technical Education Services
A Division of RAND WORLDWIDE™
Feature Failure
• If an incompatible reference has been selected, the system will inform you this option is not possible • Error message will appear
相关文档
最新文档