带有复选框的QCombobox中的错误

时间:2017-01-10 00:46:32

标签: qt

我正在尝试使用以下示例来创建带有复选框的QComboBox http://programmingexamples.net/wiki/Qt/ModelView/ComboBoxOfCheckBoxes

唯一的区别是QComboBox是可编辑的。 当选中/取消选中复选框时,我想用空格分隔的选项文本更新QComboBox文本。

例如,如果" item1" &安培; "项目3"检查后,QComboBox文本将更新为" item1 item3"

我这样做是通过将示例中的:: slot_changed()的实现更改为以下

import requests

session = requests.Session()
session.proxies = {'http':'socks5://127.0.0.1:9050'}
response = session.get('http://www.icanhazip.com', timeout=2)
print(response.text)

除非我选中/取消选中" item1",否则这似乎很有效。组合框文本仅显示" item1"即使其他人被检查。

这是一个具体的例子

    Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 501, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/usr/local/lib/python3.5/dist-packages/requests/packages/urllib3/connectionpool.py", line 594, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.5/dist-packages/requests/packages/urllib3/connectionpool.py", line 361, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.5/http/client.py", line 1106, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.5/http/client.py", line 1151, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.5/http/client.py", line 1102, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.5/http/client.py", line 934, in _send_output
    self.send(msg)
  File "/usr/lib/python3.5/http/client.py", line 877, in send
    self.connect()
  File "/usr/local/lib/python3.5/dist-packages/requests/packages/urllib3/connection.py", line 163, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.5/dist-packages/requests/packages/urllib3/contrib/socks.py", line 79, in _new_conn
    conn = socks.create_connection(
AttributeError: module 'socks' has no attribute 'create_connection'

任何人都知道问题是什么?

0 个答案:

没有答案