pyqt 自动补全

from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *

def get_data(model):
# Searching through the Doc
# Result shows in a dictionary structure
    result = {"alpha": 0, "apple": 1, "agree": 2}
    icon_address = [‘....SrcImgA.png‘, ‘....SrcImgE.png‘,‘....SrcImgO.png‘]
    for cmd, value in result.items():
        item = QStandardItem(cmd)
        item.setIcon(QIcon(icon_address[value]))
        model.insertRow(0, item)

class CodeAC:

   def __init__(self, input_line):
      self.completer = QCompleter()
      input_line.setCompleter(self.completer)
      self.model = QStandardItemModel()

   def active_script(self):
      get_data(self.model)
      self.completer.setModel(self.model)

   def tip_balloon(self):
      key = self.completer.currentRow()
      print(key)

import sys
import ctypes

class MainWindow(QWidget):

    def __init__(self):
        super(MainWindow, self).__init__()
        self.extention = None
        self.entry = QLineEdit(self)

    def init_main(self):
        self.setGeometry(600,600,800,600)
        self.setWindowTitle(‘VISA Communication‘)
        self.setWindowIcon(QIcon(‘....SrcImgicon.png‘))
        self.show()

    def active_extention(self):
        self.extention = CodeAC(self.entry)
        self.extention.active_script()

if __name__ == ‘__main__‘:

   app = QApplication(sys.argv)
   root = MainWindow()
   root.init_main()
   root.active_extention()
   sys.exit(app.exec_())

转自:https://pastebin.com/nJyVDHPM

时间: 2024-07-29 00:44:17

pyqt 自动补全的相关文章

VIM的自动补全

自动补全可以很好的提高输入的效率: 触发自动补全的方法总结: 可供弹出式菜单的使用的命令: 其它再补充:

Linux Vim中自动补全Python插件:Pydiction

Pydiction 可以是我们使用Tab键自动补全Python代码在Vim,是一款非常不错的插件. Pydiction不需要安装,所有没有任何依赖包问题,Pydiction主要包含三个文件. python_pydiction.vim  -- Vim plugin that autocompletes Python code. complete-dict         -- Dictionary file of Python keywords, modules, etc. pydiction.p

Ubuntu 16.04.2 LTS 安装python vim自动补全工具pydiction

Pydiction 可以是我们使用Tab键自动补全Python代码在Vim,是一款非常不错的插件. 下载Pydiction mkdir ~/.vim mkidr ~/.vim/tools cd ~/.vim/tools #可以先下载好放到Ubuntu系统中 git clone https://github.com/rkulla/pydiction.git 配置Pydiction #- UNIX/LINUX/OSX: Put python_pydiction.vim in ~/.vim/after

vim 添加php自动补全 并格式化代码

自动补全,修改/etc/vimrc的配置 vim /etc/vimrc 添加: filetype plugin on autocmd FileType php set omnifunc=phpcomplete#CompletePHP 格式化代码:一下是按键 gg shift + v shifg + g = 参考:

Eclipse自动补全功能管理

#这种方法只适用于Eclipse Classic版本(这个版本带有插件的源码) 在使用Eclispe的过程,感觉自动补全做的不好,没有VS的强大.下面说两个增强自动补全的方法: 1.增加Eclipse的提示功能 在Eclipse中,从Window -> preferences -> Java -> Editor -> Content assist -> Auto-Activation下,我们可以在"."号后面加入我们需要自动提示的首字幕,比如"a

Myeclipse设置关键词自动提示功能以及取消空格和"="的自动补全

一.设置Myeclipse从a~z的自动提示功能 1. “window”→“Preferences”2. 选择“Java”,展开,“Editor”,选择“Content Assist”.3. 选择“Content Assist”,然后看到右边,右边的“Auto-Activation”下面的“Auto Activation triggers for java”这个选项.其实就是指触发代码提示的就是“.”这个符号.4. “Auto Activation triggers for java”这个选项,

Vim设置括号自动补全和快速跳出

一.设置括号自动补全 inoremap ' ''<ESC>i inoremap " ""<ESC>i inoremap ( ()<ESC>i inoremap [ []<ESC>i inoremap { {}<ESC>i<CR><ESC>V<O 其中花括号{设置,自动补全并换行缩进,这在写函数的时候或语句块的时候特别有用. 参考: http://blog.csdn.net/dark_fi

Emacs 自动补全插件 ycmd

Emacs 自动补全,最好的插件当属 ycmd.以下记录我的安装过程. 1. 安装 ycmd server github 官方地址: https://github.com/Valloric/ycmd - git 克隆 ycmd 到本地 ~/ycmd $ git clone https://github.com/Valloric/ycmd.git ~/ycmd - 安装必要的编译工具和库 $ sudo apt-get install build-essential cmake python-dev

eclipse自动补全的设置(自动提示)

如果你用过Visual Studio的自动补全功能后,再来用eclipse的自动补全功能,相信大家会有些许失望. 但是eclipse其实是非常强大的,eclipse的自动补全没有VS那么好是因为eclipse的补全功能用的是默认设置.你只需要稍微修改一下就行了. 最简单的修改方式是:Windows——>Preferences——>Java-->Editor-->Content Asist,在Auto activation triggers for Java后面的文本框里只有一个“.