-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
46 lines (35 loc) · 1.25 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QAxContainer import *
class MyWindow(QMainWindow):
def __init__(self):
super().__init__()
# Kiwoom Login
self.kiwoom = QAxWidget("KHOPENAPI.KHOpenAPICtrl.1")
self.kiwoom.dynamicCall("CommConnect()")
self.kiwoom.OnEventConnect.connect(self.event_connect)
self.setWindowTitle("PyStock")
self.setGeometry(300, 300, 300, 150)
label = QLabel('종목코드: ', self)
label.move(20, 20)
self.code_edit = QLineEdit(self)
self.code_edit.move(80, 20)
self.code_edit.setText("039490")
btn1 = QPushButton("조회", self)
btn1.move(190, 20)
btn1.clicked.connect(self.btn1_clicked)
self.text_edit = QTextEdit(self)
self.text_edit.setGeometry(10, 60, 280, 80)
self.text_edit.setEnabled(False)
def event_connect(self, err_code):
if err_code == 0:
self.text_edit.append("로그인 성공")
def btn1_clicked(self):
code = self.code_edit.text()
self.text_edit.append("종목코드: " + code)
if __name__ == "__main__":
app = QApplication(sys.argv)
myWindow = MyWindow()
myWindow.show()
app.exec_()