BackEnd/Python
[Python] Jupyter Notebook 사용
ejyoovV
2021. 5. 25. 10:07
Python 에서 웹으로 Python 파일을 돌리고 싶을 때 사용하는 것이 Jupyter Notebook으로 알게되었다.
cmd에서 jupyter notebook을 실행해 본다.
// 실행할 Python 경로로 이동한 뒤 수행한다.
jupyter notebook
여기에서 Python 파일을 작성할 수 있다.
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow
from PyQt5 import uic
form_class = uic.loadUiType("./myqt01.ui")[0]
class WindowClass(QMainWindow, form_class):
def __init__(self):
super().__init__()
self.setupUi(self)
self.pb.clicked.connect(self.btnClick)
def btnClick(self):
print("버튼이 클릭되었습니다.")
self.lbl.setText("GootEvening")
if __name__ == "__main__":
app = QApplication(sys.argv)
myWindow = WindowClass()
myWindow.show()
app.exec_()
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>330</width>
<height>227</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QPushButton" name="pb">
<property name="geometry">
<rect>
<x>130</x>
<y>50</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Click</string>
</property>
</widget>
<widget class="QLabel" name="lbl">
<property name="geometry">
<rect>
<x>40</x>
<y>50</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>GootMorning</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>330</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>
예제파일이 있어서 위의 코드를 돌려보았다.
day16에가서 새로고침을 하면 Untitled.ipynb 가 생기는데 이것이 jupyter notebook을 돌린 파일이다.
dir하면 파일을 확인할 수 있다.