本文整理汇总了Python中PySimpleGUI.OK属性的典型用法代码示例。如果您正苦于以下问题:Python PySimpleGUI.OK属性的具体用法?Python PySimpleGUI.OK怎么用?Python PySimpleGUI.OK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类PySimpleGUI
的用法示例。
在下文中一共展示了PySimpleGUI.OK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_dell_smart_attributes
# 需要导入模块: import PySimpleGUI [as 别名]
# 或者: from PySimpleGUI import OK [as 别名]
def test_get_dell_smart_attributes(nvme0):
import PySimpleGUI as sg
smart = d.Buffer()
nvme0.getlogpage(0xCA, smart, 512).waitdone()
l = []
l.append('Byte | Value | Attribute')
l.append(' 0 | %5d | Re-Assigned Sector Count' % smart.data(0))
l.append(' 1 | %5d | Program Fail Count (Worst Case Component)' % smart.data(1))
l.append(' 2 | %5d | Program Fail Count (SSD Total)' % smart.data(2))
l.append(' 3 | %5d | Erase Fail Count (Worst Case Component)' % smart.data(3))
l.append(' 4 | %5d | Erase Fail Count (SSD Total)' % smart.data(4))
l.append(' 5 | %5d | Wear Leveling Count' % smart.data(5))
l.append(' 6 | %5d | Used Reserved Block Count (Worst Case Component)' % smart.data(6))
l.append(' 7 | %5d | Used Reserved Block Count (SSD Total)' % smart.data(7))
l.append('11:8 | %5d | Reserved Block Count (SSD Total)' % smart.data(11, 8))
layout = [[sg.Listbox(l, size=(70, 10))]]
sg.Window("Dell SMART Attributes",
layout+[[sg.OK()]],
font=('monospace', 16)).Read()
示例2: layout7
# 需要导入模块: import PySimpleGUI [as 别名]
# 或者: from PySimpleGUI import OK [as 别名]
def layout7():
questions = ('Managing your day-to-day life', 'Coping with problems in your life?', 'Concentrating?',
'Get along with people in your family?', 'Get along with people outside your family?',
'Get along well in social situations?', 'Feel close to another person',
'Feel like you had someone to turn to if you needed help?', 'Felt confident in yourself?')
# These are the question # and the question text
layout = [[*[sg.Text(qnum + 1, size=(2, 2)), sg.Text(q, size=(30, 2))],
# finally add an OK button at the very bottom by using the '+' operator
*[sg.Radio('', group_id=qnum, size=(7, 2), key=(qnum, col)) for col in range(5)]] for qnum, q in enumerate(questions)] + [[sg.OK()]]
window = sg.Window('Questionnaire', layout)
event, values = window.read()
print(event, values)
window.close()
示例3: sample_layout
# 需要导入模块: import PySimpleGUI [as 别名]
# 或者: from PySimpleGUI import OK [as 别名]
def sample_layout(theme_name, colors, description):
name = 'Dark' if theme_name.startswith('D') else 'Light'
name += "".join(description[:2])
layout = [[sg.Text('Text element', size=(12,1)), sg.InputText(' '.join(colors),text_color='#000000' ),sg.Radio('',theme+'1', key='-INPUT_RAD0-'+theme, default=True, metadata='#000000'),
sg.Slider((0,10),size=(10,20), orientation='h')],
[sg.T(size=(12,1)), sg.InputText(colors[0], text_color='#FFFFFF'),sg.Radio('',theme+'1', key='-INPUT_RAD1-'+theme, metadata='#FFFFFF')],
[sg.T(size=(12,1)), sg.InputText(colors[0], text_color=colors[0]),sg.Radio('',theme+'1', key='-INPUT_RAD2-'+theme, metadata=colors[0])],
[sg.T(size=(12,1)),sg.InputText(colors[3], text_color=colors[3]),sg.Radio('',theme+'1', key='-INPUT_RAD3-'+theme, metadata=colors[3])],
[sg.T(', '.join(description)), sg.In(name, key='-NEW_THEME_NAME-'+theme)],
[sg.Button('OK'), sg.Radio('',theme+'2',key='-BTN_RAD1-'+theme, default=True, metadata=sg.DEFAULT_BUTTON_COLOR),
sg.Button('OK', button_color=('white', colors[0])),sg.Radio('',theme+'2',key='-BTN_RAD2-'+theme, metadata=('white', colors[0])),
sg.Button('OK', button_color=('black', colors[0])),sg.Radio('',theme+'2',key='-BTN_RAD9-'+theme, metadata=('black', colors[0])),
sg.Button('OK', button_color=('white', colors[3])),sg.Radio('', theme+'2', key='-BTN_RAD10-' + theme, metadata=('white', colors[3])),
sg.Button('OK', button_color=('black', colors[3])),sg.Radio('', theme+'2', key='-BTN_RAD11-' + theme, metadata=('black', colors[3]))],
[sg.Button('OK', button_color=(colors[0],colors[1])),sg.Radio('',theme+'2',key='-BTN_RAD3-'+theme, metadata=(colors[0], colors[1])),
sg.Button('OK', button_color=(colors[2],colors[1])),sg.Radio('',theme+'2',key='-BTN_RAD4-'+theme, metadata=(colors[2], colors[1])),
sg.Button('OK', button_color=(colors[3],colors[1])),sg.Radio('',theme+'2',key='-BTN_RAD5-'+theme, metadata=(colors[3], colors[1])),
sg.Button('OK', button_color=(colors[3],colors[0])),sg.Radio('',theme+'2',key='-BTN_RAD7-'+theme, metadata=(colors[3], colors[0])),
sg.Button('OK', button_color=(colors[0],colors[3])),sg.Radio('',theme+'2',key='-BTN_RAD8-'+theme, metadata=(colors[0], colors[3])),
sg.Button('Cancel', button_color=(colors[3], colors[2])),sg.Radio('',theme+'2',key='-BTN_RAD6-'+theme, metadata=(colors[3], colors[2])),
] ]
return layout
# layout = [[sg.Text('Here is list of some themes', font='Default 18', background_color=WINDOW_BACKGROUND)]]
示例4: sg_show_hex_buffer
# 需要导入模块: import PySimpleGUI [as 别名]
# 或者: from PySimpleGUI import OK [as 别名]
def sg_show_hex_buffer(buf):
import PySimpleGUI as sg
layout = [ [sg.OK(), sg.Cancel()],
[sg.Multiline(buf.dump(),
enter_submits=True,
disabled=True,
size=(80, 25))]
]
sg.Window(str(buf), layout, font=('monospace', 12)).Read()
示例5: PopupDropDown
# 需要导入模块: import PySimpleGUI [as 别名]
# 或者: from PySimpleGUI import OK [as 别名]
def PopupDropDown(title, text, values):
window = sg.Window(title).Layout([[sg.Text(text)],
[sg.DropDown(values, key='_DROP_')],
[sg.OK(), sg.Cancel()]])
event, values = window.Read()
return None if event != 'OK' else values['_DROP_']
# ----------------------- Calling your PopupDropDown function -----------------------
示例6: second_window
# 需要导入模块: import PySimpleGUI [as 别名]
# 或者: from PySimpleGUI import OK [as 别名]
def second_window():
layout = [[sg.Text('The second form is small \nHere to show that opening a window using a window works')],
[sg.OK()]]
window = sg.Window('Second Form', layout)
event, values = window.read()
window.close()
示例7: layout2
# 需要导入模块: import PySimpleGUI [as 别名]
# 或者: from PySimpleGUI import OK [as 别名]
def layout2():
layout = [[sg.Button(i) for i in range(4)]] + [[sg.OK()]] # if want to split, can't add newline after + to do it
window = sg.Window('Generated Layouts', layout)
event, values = window.Read()
print(event, values)
window.Close()
示例8: layout3
# 需要导入模块: import PySimpleGUI [as 别名]
# 或者: from PySimpleGUI import OK [as 别名]
def layout3():
# in terms of formatting, the layout to the RIGHT of the = sign looks like a 2-line GUI (ignore the layout +=
layout = [[sg.Button(i) for i in range(4)]]
layout += [[sg.OK()]] # this row is better than, but is the same as
layout.append([sg.Cancel()]) # .. this row in that they both add a new ROW with a button on it
window = sg.Window('Generated Layouts', layout)
event, values = window.Read()
print(event, values)
window.Close()
示例9: layout5
# 需要导入模块: import PySimpleGUI [as 别名]
# 或者: from PySimpleGUI import OK [as 别名]
def layout5():
questions = ('Managing your day-to-day life', 'Coping with problems in your life?', 'Concentrating?',
'Get along with people in your family?', 'Get along with people outside your family?',
'Get along well in social situations?', 'Feel close to another person',
'Feel like you had someone to turn to if you needed help?', 'Felt confident in yourself?')
layout = [[sg.T(qnum + 1, size=(2, 2)), sg.T(q, size=(30, 2))] + [sg.Radio('', group_id=qnum, size=(7, 2), key=(qnum, col)) for col in range(5)] for qnum, q in enumerate(questions)]
layout += [[sg.OK()]]
window = sg.Window('Computed Layout Questionnaire', layout)
event, values = window.Read()
print(event, values)
window.Close()
示例10: layout7
# 需要导入模块: import PySimpleGUI [as 别名]
# 或者: from PySimpleGUI import OK [as 别名]
def layout7():
questions = ('Managing your day-to-day life', 'Coping with problems in your life?', 'Concentrating?',
'Get along with people in your family?', 'Get along with people outside your family?',
'Get along well in social situations?', 'Feel close to another person',
'Feel like you had someone to turn to if you needed help?', 'Felt confident in yourself?')
layout = [[*[sg.T(qnum + 1, size=(2, 2)), sg.T(q, size=(30, 2))], # These are the question # and the question text
*[sg.Radio('', group_id=qnum, size=(7, 2), key=(qnum, col)) for col in range(5)]] for qnum, q in enumerate(questions)] + [[sg.OK()]] # finally add an OK button at the very bottom by using the '+' operator
window = sg.Window('Questionnaire', layout)
event, values = window.Read()
print(event, values)
window.Close()
示例11: PopupDropDown
# 需要导入模块: import PySimpleGUI [as 别名]
# 或者: from PySimpleGUI import OK [as 别名]
def PopupDropDown(title, text, values):
window = sg.Window(title,
[[sg.Text(text)],
[sg.DropDown(values, key='-DROP-')],
[sg.OK(), sg.Cancel()]
])
event, values = window.read()
return None if event != 'OK' else values['-DROP-']
# ----------------------- Calling your PopupDropDown function -----------------------
示例12: layout2
# 需要导入模块: import PySimpleGUI [as 别名]
# 或者: from PySimpleGUI import OK [as 别名]
def layout2():
# if want to split, can't add newline after + to do it
layout = [[sg.Button(i) for i in range(4)]] + [[sg.OK()]]
window = sg.Window('Generated Layouts', layout)
event, values = window.read()
print(event, values)
window.close()
示例13: layout3
# 需要导入模块: import PySimpleGUI [as 别名]
# 或者: from PySimpleGUI import OK [as 别名]
def layout3():
# in terms of formatting, the layout to the RIGHT of the = sign looks like a 2-line GUI (ignore the layout +=
layout = [[sg.Button(i) for i in range(4)]]
# this row is better than, but is the same as
layout += [[sg.OK()]]
# .. this row in that they both add a new ROW with a button on it
layout.append([sg.Cancel()])
window = sg.Window('Generated Layouts', layout)
event, values = window.read()
print(event, values)
window.close()
示例14: layout6
# 需要导入模块: import PySimpleGUI [as 别名]
# 或者: from PySimpleGUI import OK [as 别名]
def layout6():
questions = ('Managing your day-to-day life', 'Coping with problems in your life?', 'Concentrating?',
'Get along with people in your family?', 'Get along with people outside your family?',
'Get along well in social situations?', 'Feel close to another person',
'Feel like you had someone to turn to if you needed help?', 'Felt confident in yourself?')
layout = [[]]
for qnum, question in enumerate(questions):
# rows start with # and question
row_layout = [sg.Text(qnum + 1, size=(2, 2)),
sg.Text(question, size=(30, 2))]
# loop through 5 radio buttons and add to row
for radio_num in range(5):
row_layout += [sg.Radio('', group_id=qnum,
size=(7, 2), key=(qnum, radio_num))]
# after row is completed layout, tack it onto the end of final layout
layout += [row_layout]
# and finally, add a row to the bottom that has an OK button
layout += [[sg.OK()]]
window = sg.Window('Computed Layout Questionnaire', layout)
event, values = window.read()
print(event, values)
window.close()
示例15: test_get_smart_health_information
# 需要导入模块: import PySimpleGUI [as 别名]
# 或者: from PySimpleGUI import OK [as 别名]
def test_get_smart_health_information(nvme0):
from pytemperature import k2c
import PySimpleGUI as sg
smart = d.Buffer()
nvme0.getlogpage(0x02, smart, 512).waitdone()
l = []
l.append(' Byte | Value | Attribute')
l.append(' 0 | %7d | Critical Warning' % smart.data(0))
l.append(' 2: 1 | %7d | Composite Temperature (degree C)' % k2c(smart.data(2, 1)))
l.append(' 3 | %7d | Available Spare' % smart.data(3))
l.append(' 4 | %7d | Available Spare Threshold' % smart.data(4))
l.append(' 5 | %7d | Percentage Used' % smart.data(5))
l.append(' 6 | %7d | Endurance Group Critical Warning Summary' % smart.data(6))
l.append(' 47:32 |%11d| Data Units Read (1000LBA)' % smart.data(47, 32))
l.append(' 63:48 |%11d| Data Units Written (1000LBA)' % smart.data(63, 48))
l.append(' 79:64 |%11d| Host Read Commands' % smart.data(79, 64))
l.append(' 95:80 |%11d| Host Write Commands' % smart.data(95, 80))
l.append('111:96 | %7d | Controller Busy Time (minutes)' % smart.data(111, 96))
l.append('127:112| %7d | Power Cycles' % smart.data(127, 112))
l.append('143:128| %7d | Power On Hours' % smart.data(143, 128))
l.append('159:144| %7d | Unsafe Shutdowns' % smart.data(159, 144))
l.append('175:160| %7d | Media and Data Integrity Errors' % smart.data(175, 160))
l.append('191:176| %7d | Number of Error Information Log Entries' % smart.data(191, 176))
l.append('195:192| %7d | Warning Composite Temperature Time (minutes)' % smart.data(195, 192))
l.append('199:196| %7d | Critical Composite Temperature Time (minutes)' % smart.data(199, 196))
l.append('201:200| %7d | Temperature Sensor 1 (degree C)' % k2c(smart.data(201, 200)))
l.append('203:202| %7d | Temperature Sensor 2 (degree C)' % k2c(smart.data(203, 202)))
l.append('205:204| %7d | Temperature Sensor 3 (degree C)' % k2c(smart.data(205, 204)))
l.append('207:206| %7d | Temperature Sensor 4 (degree C)' % k2c(smart.data(207, 206)))
l.append('209:208| %7d | Temperature Sensor 5 (degree C)' % k2c(smart.data(209, 208)))
l.append('211:210| %7d | Temperature Sensor 6 (degree C)' % k2c(smart.data(211, 210)))
l.append('213:212| %7d | Temperature Sensor 7 (degree C)' % k2c(smart.data(213, 212)))
l.append('215:214| %7d | Temperature Sensor 8 (degree C)' % k2c(smart.data(215, 214)))
l.append('219:216| %7d | Thermal Management Temperature 1 Transition Count' % smart.data(219, 216))
l.append('223:220| %7d | Thermal Management Temperature 2 Transition Count' % smart.data(223, 220))
l.append('227:224| %7d | Total Time For Thermal Management Temperature 1' % smart.data(227, 224))
l.append('231:228| %7d | Total Time For Thermal Management Temperature 2' % smart.data(231, 228))
layout = [[sg.Listbox(l, size=(70, 20))]]
sg.Window("SMART/Health Information",
layout+[[sg.OK()]],
font=('monospace', 16)).Read()