当前位置: 首页>>代码示例>>Python>>正文


Python QTextEdit.setMinimumWidth方法代码示例

本文整理汇总了Python中PySide.QtGui.QTextEdit.setMinimumWidth方法的典型用法代码示例。如果您正苦于以下问题:Python QTextEdit.setMinimumWidth方法的具体用法?Python QTextEdit.setMinimumWidth怎么用?Python QTextEdit.setMinimumWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide.QtGui.QTextEdit的用法示例。


在下文中一共展示了QTextEdit.setMinimumWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Airport_project_UI

# 需要导入模块: from PySide.QtGui import QTextEdit [as 别名]
# 或者: from PySide.QtGui.QTextEdit import setMinimumWidth [as 别名]
class Airport_project_UI(QWidget):

    airports = [
        'KRK',
        'LA',
        'LIS'
    ]

    elitism_possibly_values = ['true', 'false']

    max_flights_list = ['1', '2', '3', '4', '5']

    def __init__(self):
        QWidget.__init__(self)
        self.params = {}

       # self.setMinimumSize(600, 250)
        #self.setWindowTitle("Medody Optymalizacji - Projekt")
       # self.setIcon()

        self.start_airport_label = QLabel("Start airport:", self)
        self.start_airport_label.move(5, 10)
        self.start_airport = QLineEdit(self)
        self.start_airport.setText('1')
        #self.start_airport.addItems(self.airports)
        self.start_airport.setMinimumHeight(20)
        self.start_airport.setMaximumHeight(20)
        self.start_airport.setMinimumWidth(60)
        self.start_airport.setMaximumWidth(60)
        self.start_airport.move(150, 5)

#TODO function to convert names of airport to indexes

        self.destination_airport_label = QLabel("Destination airport:", self)
        self.destination_airport_label.move(5, 40)
        self.destination_airport = QLineEdit(self)
        self.destination_airport.setText('2')
       # self.destination_airport.addItems(self.airports)
        self.destination_airport.setMinimumHeight(20)
        self.destination_airport.setMaximumHeight(20)
        self.destination_airport.setMaximumWidth(60)
        self.destination_airport.setMinimumWidth(60)
        self.destination_airport.move(150, 35)

        self.max_flights_label = QLabel("max number of flights:", self)
        self.max_flights_label.move(5, 70)
        self.max_flights = QLineEdit(self)
        self.max_flights.setText("3")
        #self.max_flights.addItems(self.max_flights_list)
        self.max_flights.setMaximumHeight(20)
        self.max_flights.setMinimumHeight(20)
        self.max_flights.setMaximumWidth(60)
        self.max_flights.setMinimumWidth(60)
        #self.max_flights.setMinimumWidth(60)
        self.max_flights.move(150, 65)

        self.cost_weight_label = QLabel("max cost weights:", self)
        self.cost_weight_label.move(5, 100)
        self.cost_weight = QLineEdit(self)
        self.cost_weight.setText("4")
        self.cost_weight.setMinimumWidth(60)
        self.cost_weight.setMaximumWidth(60)
        self.cost_weight.setMinimumHeight(20)
        self.cost_weight.setMaximumHeight(20)
        self.cost_weight.move(150, 95)


        self.time_weight_label = QLabel("time weight:", self)
        self.time_weight_label.move(5, 130)
        self.time_weight = QLineEdit(self)
        self.time_weight.setText("5")
        self.time_weight.setMinimumWidth(60)
        self.time_weight.setMaximumWidth(60)
        self.time_weight.setMinimumHeight(20)
        self.time_weight.setMaximumHeight(20)
        self.time_weight.move(150, 125)

        self.pop_size_label = QLabel("pop size:", self)
        self.pop_size_label.move(5, 160)  # +30

        self.pop_size = QLineEdit(self)
        self.pop_size.setText("6")
        self.pop_size.setMinimumWidth(60)
        self.pop_size.setMaximumWidth(60)
        self.pop_size.setMinimumHeight(20)
        self.pop_size.setMaximumHeight(20)
        self.pop_size.move(150, 155) # +30

        self.generation_label = QLabel("generations:", self)
        self.generation_label.move(5, 190)  # +30

        self.generation = QLineEdit(self)
        self.generation.setText("7")
        self.generation.setMinimumWidth(60)
        self.generation.setMaximumWidth(60)
        self.generation.setMinimumHeight(20)
        self.generation.setMaximumHeight(20)
        self.generation.move(150, 185) # +30

        self.mutation_rate_label = QLabel("mutation rate:", self)
#.........这里部分代码省略.........
开发者ID:Filios92,项目名称:ProjektMO,代码行数:103,代码来源:MO_project.py

示例2: qNotebook

# 需要导入模块: from PySide.QtGui import QTextEdit [as 别名]
# 或者: from PySide.QtGui.QTextEdit import setMinimumWidth [as 别名]
class qNotebook(QVBoxLayout):
    def __init__(self):
        QVBoxLayout.__init__(self)
        self._teditor = QTextEdit()
        self._teditor.setMinimumWidth(500)
        self._teditor.setStyleSheet("font: 12pt \"Courier\";")
        button_layout = QHBoxLayout()
        self.addLayout(button_layout)
        self.clear_but = qmy_button(button_layout, self.clear_all, "clear")
        self.copy_but = qmy_button(button_layout, self._teditor.copy, "copy")
        qmy_button(button_layout, self._teditor.selectAll, "select all")
        qmy_button(button_layout, self._teditor.undo, "undo")
        qmy_button(button_layout, self._teditor.redo, "redo")
        search_button = qButtonWithArgumentsClass("search", self.search_for_text, {"search_text": ""})
        button_layout.addWidget(search_button)
        qmy_button(button_layout, self.save_as_html, "save notebook")
        
        self.addWidget(self._teditor)
        self._teditor.document().setUndoRedoEnabled(True)
        self.image_counter = 0
        self.image_dict = {}
        self.image_data_dict = {}
        
    def append_text(self, text):
        self._teditor.append(str(text))
        
    def search_for_text(self, search_text = " "):
        self._teditor.find(search_text)
        
    def clear_all(self):
        self._teditor.clear()
        self.image_dict = {}
        self.image_counter = 0
#        newdoc = QTextDocument()
#        self._teditor.setDocument(newdoc)
        
    def append_image(self, fig=None):
        #This assumes that an image is there waiting to be saved from matplotlib
        self.imgdata = StringIO.StringIO()
        if fig is None:
            pyplot.savefig(self.imgdata, transparent = False, format = img_format)
        else:
            fig.savefig(self.imgdata, transparent = False, format = img_format)
        self.abuffer = QBuffer()
        self.abuffer.open(QBuffer.ReadWrite)
        self.abuffer.write(self.imgdata.getvalue())
        self.abuffer.close()
        
        self.abuffer.open(QBuffer.ReadOnly)
        iReader = QImageReader(self.abuffer, img_format )
        the_image = iReader.read()
        # the_image = the_image0.scaledToWidth(figure_width)
        
        # save the image in a file
        imageFileName = "image" + str(self.image_counter) + "." + img_format
        self.image_data_dict[imageFileName] = self.imgdata
        
        self.image_counter +=1
        imageFormat = QTextImageFormat()
        imageFormat.setName(imageFileName)
        imageFormat.setWidth(image_width)
        self.image_dict[imageFileName] = the_image
        
        #insert the image in the text document
        text_doc = self._teditor.document()
        text_doc.addResource(QTextDocument.ImageResource, QUrl(imageFileName), the_image)
        cursor = self._teditor.textCursor()
        cursor.movePosition(QTextCursor.End)
        cursor.insertImage(imageFormat)
        
    def add_image_data_resource(self, imgdata, imageFileName):
        
        self.abuffer = QBuffer()
        self.abuffer.open(QBuffer.ReadWrite)
        self.abuffer.write(imgdata.getvalue())
        self.abuffer.close()
        
        self.abuffer.open(QBuffer.ReadOnly)
        iReader = QImageReader(self.abuffer, img_format )
        the_image = iReader.read()
        # the_image = the_image0.scaledToWidth(figure_width)
        
        # save the image in a file
        # imageFileName = "image" + str(self.image_counter) + "." + img_format
        self.image_data_dict[imageFileName] = imgdata
        
        # self.image_counter +=1
        imageFormat = QTextImageFormat()
        imageFormat.setName(imageFileName)
        imageFormat.setWidth(image_width)
        self.image_dict[imageFileName] = the_image
        
        #insert the image in the text document
        text_doc = self._teditor.document()
        text_doc.addResource(QTextDocument.ImageResource, QUrl(imageFileName), the_image)
        
    
    def append_html_table_from_array(self, a, header_rows=0, precision = 3, caption = None, cmap = None):
        nrows = len(a)
        ncols = len(a[0])
#.........这里部分代码省略.........
开发者ID:bsherin,项目名称:shared_tools,代码行数:103,代码来源:qnotebook.py


注:本文中的PySide.QtGui.QTextEdit.setMinimumWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。