728x90
test2.yaml
0.00MB
yml_sample7.pyw
0.00MB
#-*- coding: utf-8 -*-
import yaml
import wx
import os
import sys
#sys.setdefaultencoding('utf-8')
doc = yaml.load(open('test2.yaml', 'r',encoding='utf-8'))
strs = doc['strs']
for s in strs:
print(s) # 철수, 영희, 명수
if __name__ == '__main__':
app = wx.PySimpleApp()
dlg = wx.SingleChoiceDialog(None,
'What version of Python are you using?',
'Single Choice',
strs,
wx.CHOICEDLG_STYLE)
if dlg.ShowModal() == wx.ID_OK:
response = dlg.GetStringSelection()
print(response)
if response == "철수" :
print(1)
elif response == "영희" :
print(2)
else :
print(3)
dlg.Destroy()
app.MainLoop()
결과
728x90
'개발자 모드 > 파이썬(python)' 카테고리의 다른 글
파이썬 yaml 설치 하기 (0) | 2021.05.27 |
---|---|
파이썬 기본 Dialog Sample (0) | 2021.05.20 |
파이썬 UnicodeDecodeError: 'cp949' codec can't decode byte 0xec in position 23: illegal multibyte sequence 에러 시... (0) | 2021.05.20 |
파이썬 yaml로 SingleChoiceDialog 만들기 (0) | 2021.05.20 |
파이썬 wx.SingleChoiceDialog 예제 (1) | 2021.05.19 |