Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.60 KB | None | 0 0
  1. import sys
  2. from PyQt5 import QtWidgets, QtGui
  3. from PyQt5.QtWidgets import QApplication, QWidget,QPushButton,QAction,QLineEdit,QMessageBox,QLabel,QComboBox
  4. from PyQt5.QtGui import QIcon
  5. from PyQt5.QtCore import pyqtSlot
  6.  
  7. def Okna(numer):
  8. if numer==1:
  9. if __name__=='__main__':
  10. app=QApplication(sys.argv)
  11. ex=App()
  12. ex.show()
  13. app.exec()
  14. #sys.exit(app.exec_())
  15. if numer==2:
  16. if __name__=='__main__':
  17. app=QApplication(sys.argv)
  18. ex=Prostokaty()
  19. ex.show()
  20. app.exec()
  21. if numer==3:
  22. if __name__=='__main__':
  23. app=QApplication(sys.argv)
  24. ex=Trapezy()
  25. ex.show()
  26. app.exec()
  27. if numer==3:
  28. if __name__=='__main__':
  29. app=QApplication(sys.argv)
  30. ex=MonteCarlo()
  31. ex.show()
  32. app.exec()
  33. if numer==4:
  34. if __name__=='__main__':
  35. app=QApplication(sys.argv)
  36. ex=Simpson()
  37. ex.show()
  38. app.exec()
  39.  
  40.  
  41.  
  42. class Prostokaty(QWidget):
  43.  
  44. def on_wroc(self):
  45. child = App()
  46. child.show()
  47. self.children.append(child)
  48.  
  49. def __init__(self):
  50. super().__init__()
  51. self.title='Liczenie Całek Różnymi Metodami'
  52. self.left=100
  53. self.top=100
  54. self.width=640
  55. self.height=480
  56. self.initUI()
  57. def initUI(self):
  58. self.setWindowTitle(self.title)
  59. self.setGeometry(self.left,self.top,self.width,self.height)
  60.  
  61. label = QLabel('Metoda Prostokątów',self)
  62. label.move(190,40)
  63. label.setFont(QtGui.QFont("Times", 16, QtGui.QFont.Bold))
  64.  
  65. Funkcja = QLabel('Funkcja',self)
  66. Funkcja.move(50,160)
  67. Funkcja.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  68.  
  69. A = QLabel('Początek przedziału',self)
  70. A.move(50,200)
  71. A.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  72.  
  73. B = QLabel('Koniec przedziału',self)
  74. B.move(50,240)
  75. B.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  76.  
  77. Krok = QLabel('Krok ',self)
  78. Krok.move(50,280)
  79. Krok.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  80.  
  81. sposób = QLabel('Sposób pomiarów',self)
  82. sposób.move(50,320)
  83. sposób.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  84.  
  85. textboxFunkcja = QLineEdit(self)
  86. textboxFunkcja.move(300,151)
  87. textboxFunkcja.resize(200,36)
  88.  
  89. textboxA = QLineEdit(self)
  90. textboxA.move(300,191)
  91. textboxA.resize(200,36)
  92.  
  93. textboxB = QLineEdit(self)
  94. textboxB.move(300,231)
  95. textboxB.resize(200,36)
  96.  
  97. textboxKrok = QLineEdit(self)
  98. textboxKrok.move(300,271)
  99. textboxKrok.resize(200,36)
  100.  
  101. comboBoxsposób = QComboBox(self)
  102. comboBoxsposób.addItem("Prawo")
  103. comboBoxsposób.addItem("Lewo")
  104. comboBoxsposób.addItem("Środek")
  105. comboBoxsposób.move(300,311)
  106. comboBoxsposób.resize(200,36)
  107. comboBoxsposób.setStyleSheet('background-color: white;')
  108. comboBoxsposób.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  109.  
  110. ObliczP=QPushButton('Oblicz',self)
  111. #ObliczP.clicked.connect()
  112. ObliczP.move(50,380)
  113. ObliczP.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  114. ObliczP.resize(100,36)
  115.  
  116. WrocP=QPushButton('Wróć',self)
  117. WrocP.clicked.connect(self.on_wroc)
  118. self.children = []
  119. WrocP.move(500,380)
  120. WrocP.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  121. WrocP.resize(100,36)
  122.  
  123.  
  124. self.show()
  125.  
  126. class Trapezy(QWidget):
  127.  
  128. def on_wroc(self):
  129. child = App()
  130. child.show()
  131. self.children.append(child)
  132.  
  133. def __init__(self):
  134. super().__init__()
  135. self.title='Liczenie Całek Różnymi Metodami'
  136. self.left=100
  137. self.top=100
  138. self.width=640
  139. self.height=480
  140. self.initUI()
  141. def initUI(self):
  142. self.setWindowTitle(self.title)
  143. self.setGeometry(self.left,self.top,self.width,self.height)
  144.  
  145. label = QLabel('Metoda Trapezów',self)
  146. label.move(190,40)
  147. label.setFont(QtGui.QFont("Times", 16, QtGui.QFont.Bold))
  148.  
  149. Funkcja = QLabel('Funkcja',self)
  150. Funkcja.move(50,160)
  151. Funkcja.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  152.  
  153. A = QLabel('Początek przedziału',self)
  154. A.move(50,200)
  155. A.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  156.  
  157. B = QLabel('Koniec przedziału',self)
  158. B.move(50,240)
  159. B.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  160.  
  161. Krok = QLabel('Krok ',self)
  162. Krok.move(50,280)
  163. Krok.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  164.  
  165. textboxFunkcja = QLineEdit(self)
  166. textboxFunkcja.move(300,151)
  167. textboxFunkcja.resize(200,36)
  168.  
  169. textboxA = QLineEdit(self)
  170. textboxA.move(300,191)
  171. textboxA.resize(200,36)
  172.  
  173. textboxB = QLineEdit(self)
  174. textboxB.move(300,231)
  175. textboxB.resize(200,36)
  176.  
  177. textboxKrok = QLineEdit(self)
  178. textboxKrok.move(300,271)
  179. textboxKrok.resize(200,36)
  180.  
  181.  
  182. ObliczT=QPushButton('Oblicz',self)
  183. #ObliczT.clicked.connect()
  184. ObliczT.move(50,380)
  185. ObliczT.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  186. ObliczT.resize(100,36)
  187.  
  188. WrocT=QPushButton('Wróć',self)
  189. WrocT.clicked.connect(self.on_wroc)
  190. self.children = []
  191. WrocT.move(500,380)
  192. WrocT.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  193. WrocT.resize(100,36)
  194.  
  195.  
  196. self.show()
  197.  
  198. class MonteCarlo(QWidget):
  199.  
  200.  
  201. def on_wroc(self):
  202. child = App()
  203. child.show()
  204. self.children.append(child)
  205.  
  206. def __init__(self):
  207. super().__init__()
  208. self.title='Liczenie Całek Różnymi Metodami'
  209. self.left=100
  210. self.top=100
  211. self.width=640
  212. self.height=480
  213. self.initUI()
  214. def initUI(self):
  215. self.setWindowTitle(self.title)
  216. self.setGeometry(self.left,self.top,self.width,self.height)
  217.  
  218. label = QLabel('Metoda MonteCarlo',self)
  219. label.move(190,40)
  220. label.setFont(QtGui.QFont("Times", 16, QtGui.QFont.Bold))
  221.  
  222. Funkcja = QLabel('Funkcja',self)
  223. Funkcja.move(50,160)
  224. Funkcja.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  225.  
  226. A = QLabel('Początek przedziału',self)
  227. A.move(50,200)
  228. A.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  229.  
  230. B = QLabel('Koniec przedziału',self)
  231. B.move(50,240)
  232. B.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  233.  
  234. Krok = QLabel('Krok ',self)
  235. Krok.move(50,280)
  236. Krok.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  237.  
  238.  
  239. textboxFunkcja = QLineEdit(self)
  240. textboxFunkcja.move(300,151)
  241. textboxFunkcja.resize(200,36)
  242.  
  243. textboxA = QLineEdit(self)
  244. textboxA.move(300,191)
  245. textboxA.resize(200,36)
  246.  
  247. textboxB = QLineEdit(self)
  248. textboxB.move(300,231)
  249. textboxB.resize(200,36)
  250.  
  251. textboxKrok = QLineEdit(self)
  252. textboxKrok.move(300,271)
  253. textboxKrok.resize(200,36)
  254.  
  255.  
  256. ObliczM=QPushButton('Oblicz',self)
  257. #ObliczM.clicked.connect()
  258. ObliczM.move(50,380)
  259. ObliczM.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  260. ObliczM.resize(100,36)
  261.  
  262. WrocM=QPushButton('Wróć',self)
  263. WrocM.clicked.connect(self.on_wroc)
  264. self.children = []
  265. WrocM.move(500,380)
  266. WrocM.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  267. WrocM.resize(100,36)
  268.  
  269.  
  270. self.show()
  271.  
  272. class Simpson(QWidget):
  273.  
  274. def on_wroc(self):
  275. child = App()
  276. child.show()
  277. self.children.append(child)
  278.  
  279.  
  280. def __init__(self):
  281. super().__init__()
  282. self.title='Liczenie Całek Różnymi Metodami'
  283. self.left=100
  284. self.top=100
  285. self.width=640
  286. self.height=480
  287. self.initUI()
  288. def initUI(self):
  289. self.setWindowTitle(self.title)
  290. self.setGeometry(self.left,self.top,self.width,self.height)
  291.  
  292. label = QLabel('Metoda Simpsona',self)
  293. label.move(190,40)
  294. label.setFont(QtGui.QFont("Times", 16, QtGui.QFont.Bold))
  295.  
  296. Funkcja = QLabel('Funkcja',self)
  297. Funkcja.move(50,160)
  298. Funkcja.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  299.  
  300. A = QLabel('Początek przedziału',self)
  301. A.move(50,200)
  302. A.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  303.  
  304. B = QLabel('Koniec przedziału',self)
  305. B.move(50,240)
  306. B.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  307.  
  308. Krok = QLabel('Krok ',self)
  309. Krok.move(50,280)
  310. Krok.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  311.  
  312. textboxFunkcja = QLineEdit(self)
  313. textboxFunkcja.move(300,151)
  314. textboxFunkcja.resize(200,36)
  315.  
  316. textboxA = QLineEdit(self)
  317. textboxA.move(300,191)
  318. textboxA.resize(200,36)
  319.  
  320. textboxB = QLineEdit(self)
  321. textboxB.move(300,231)
  322. textboxB.resize(200,36)
  323.  
  324. textboxKrok = QLineEdit(self)
  325. textboxKrok.move(300,271)
  326. textboxKrok.resize(200,36)
  327.  
  328. ObliczS=QPushButton('Oblicz',self)
  329. #ObliczS.clicked.connect()
  330. ObliczS.move(50,380)
  331. ObliczS.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  332. ObliczS.resize(100,36)
  333.  
  334. WrocS=QPushButton('Wróć',self)
  335. WrocS.clicked.connect(self.on_wroc)
  336. self.children = []
  337. WrocS.move(500,380)
  338. WrocS.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  339. WrocS.resize(100,36)
  340.  
  341.  
  342. self.show()
  343.  
  344. class App(QWidget):
  345.  
  346. def on_prosto(self):
  347. child = Prostokaty()
  348. child.show()
  349. self.children.append(child)
  350.  
  351. def on_trapez(self):
  352. child = Trapezy()
  353. child.show()
  354. self.children.append(child)
  355.  
  356. def on_mc(self):
  357. child = MonteCarlo()
  358. child.show()
  359. self.children.append(child)
  360.  
  361. def on_sim(self):
  362. child = Simpson()
  363. child.show()
  364. self.children.append(child)
  365.  
  366. def __init__(self):
  367. super().__init__()
  368. self.title='Liczenie Całek Różnymi Metodami'
  369. self.left=100
  370. self.top=100
  371. self.width=640
  372. self.height=480
  373. self.initUI()
  374.  
  375. def initUI(self):
  376.  
  377. self.setWindowTitle(self.title)
  378. self.setGeometry(self.left,self.top,self.width,self.height)
  379.  
  380. label = QLabel('Wybierz metode obliczania całek',self)
  381. label.move(150,40)
  382. label.setFont(QtGui.QFont("Times", 16, QtGui.QFont.Bold))
  383.  
  384. #self.textbox=QLineEdit(self)
  385. #self.textbox.move(50,70)
  386. #self.textbox.resize(70,30)
  387.  
  388. Prosto=QPushButton('Metoda Prostokątów',self)
  389. Prosto.clicked.connect(self.on_prosto)
  390. self.children = []
  391. Prosto.move(50,160)
  392. Prosto.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  393.  
  394. Trapez=QPushButton('Metoda Trapezów',self)
  395. Trapez.clicked.connect(self.on_trapez)
  396. self.children = []
  397. Trapez.move(50,200)
  398. Trapez.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  399.  
  400. MonteCarlo=QPushButton('Metoda MonteCarlo',self)
  401. MonteCarlo.clicked.connect(self.on_mc)
  402. self.children = []
  403. MonteCarlo.move(50,240)
  404. MonteCarlo.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  405.  
  406. Simpson=QPushButton('Metoda Simpsona',self)
  407. MonteCarlo.clicked.connect(self.on_sim)
  408. self.children = []
  409. Simpson.move(50,280)
  410. Simpson.setFont(QtGui.QFont("Times", 12, QtGui.QFont.Bold))
  411.  
  412.  
  413. self.show()
  414.  
  415.  
  416.  
  417.  
  418. Okna(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement