Advertisement
Guest User

Untitled

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