개발자 모드/파이썬(python)

파이썬 yaml로 SingleChoiceDialog 만들기

인생은직구 2021. 5. 20. 15:51
728x90

test.yaml
0.00MB
yml_sample4.pyw
0.00MB

import yaml
import wx
import os,sys


 
doc = yaml.load(open('test.yaml', 'r'))
strs = doc['strs']
 
for s in strs:
    print(s)  # a, b, c

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)
    dlg.Destroy()
    app.MainLoop()



 

 

결과

 

 

 

728x90