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


Python QtOpenGL.QGLWidget类代码示例

本文整理汇总了Python中PyQt4.QtOpenGL.QGLWidget的典型用法代码示例。如果您正苦于以下问题:Python QGLWidget类的具体用法?Python QGLWidget怎么用?Python QGLWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __init__

    def __init__(self, motor, ancho, alto, gestor_escenas, permitir_depuracion,
                 rendimiento):
        QGLWidget.__init__(self, None)

        self.painter = QtGui.QPainter()

        self.pausa_habilitada = False

        self.setMouseTracking(True)
        self.mouse_x = 0
        self.mouse_y = 0

        self.motor = motor

        self.fps = fps.FPS(rendimiento, True)

        if permitir_depuracion:
            self.depurador = depurador.Depurador(motor.obtener_lienzo(), self.fps)
        else:
            self.depurador = depurador.DepuradorDeshabilitado()

        self.original_width = ancho
        self.original_height = alto

        self.escala = 1

        self.startTimer(1000/100.0)

        self.gestor_escenas = gestor_escenas
开发者ID:ipedrazas,项目名称:pilas,代码行数:29,代码来源:motor_qt.py

示例2: _init_specific

 def _init_specific(self, vsync, dec, fs, parent, context, kwargs):
     
     # Deal with context
     if not context.istaken:
         widget = kwargs.pop('shareWidget', None) or self
         context.take('qt', widget)
         glformat = _set_config(context.config)
         glformat.setSwapInterval(1 if vsync else 0)
         if widget is self:
             widget = None  # QGLWidget does not accept self ;)
     elif context.istaken == 'qt':
         widget = context.backend_canvas
         glformat = QGLFormat.defaultFormat()
         if 'shareWidget' in kwargs:
             raise RuntimeError('Cannot use vispy to share context and '
                                'use built-in shareWidget.')
     else:
         raise RuntimeError('Different backends cannot share a context.')
     
     # first arg can be glformat, or a gl context
     f = QtCore.Qt.Widget if dec else QtCore.Qt.FramelessWindowHint
     QGLWidget.__init__(self, glformat, parent, widget, f)
     self._initialized = True
     if not self.isValid():
         raise RuntimeError('context could not be created')
     self.setAutoBufferSwap(False)  # to make consistent with other backends
开发者ID:Peque,项目名称:vispy,代码行数:26,代码来源:_qt.py

示例3: __init__

	def __init__(self, parent=None):
		QGLWidget.__init__(self, parent)

		self._zoom = 1.0
		self._scene = None
		self._rotation = [0, 0, 0]
		
		self._mouseLeftDown     = False
		self._mouseRightDown    = False

		self._mouseGLPosition       = [0,0,0]
		self._lastMouseGLPosition   = [0,0,0]

		self._mousePosition         = [0,0]  #Current mouse position
		self._lastMousePosition     = [0,0]  #Last mouse position

		self._mouseStartDragPoint   = None
		self._clear_color = None
		
		self.setMinimumHeight(100)
		self.setMinimumWidth(100)
		self.setMouseTracking(True)
		self.setAcceptDrops(True)

		self.setSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding);
开发者ID:AlfiyaZi,项目名称:pyforms,代码行数:25,代码来源:ControlOpenGL.py

示例4: __init__

    def __init__(self, parent=None, name=None):
        QGLWidget.__init__(self, parent, name)
        self.parent = parent

        self.vertices = (
            (-1.0,-1.0,-1.0),
            (1.0,-1.0,-1.0),
            (1.0,1.0,-1.0),
            (-1.0,1.0,-1.0),
            (-1.0,-1.0,1.0),
            (1.0,-1.0,1.0),
            (1.0,1.0,1.0),
            (-1.0,1.0,1.0)
        )

        self.pins = [(-0.8, -0.9), (-0.8, -0.65), (-0.8, -0.4),
                     (-0.6, -0.9), (-0.6, -0.65), (-0.6, -0.4),
                     (0.9, 0.8), (0.65, 0.8), (0.4, 0.8), (0.15, 0.8),
                     (0.9, 0.6), (0.65, 0.6), (0.4, 0.6), (0.15, 0.6)]

        self.m = [[1, 0, 0, 0],
                  [0, 1, 0, 0],
                  [0, 0, 1, 0],
                  [0, 0, 0, 1]]

        self.rel_x = 0
        self.rel_y = 0
        self.rel_z = 0
        self.rel_w = 0

        self.save_orientation_flag = False
        self.has_save_orientation = False
        self.display_list = None
开发者ID:makerpc,项目名称:brickv,代码行数:33,代码来源:imu_gl_widget.py

示例5: _get_bg_image_comparison_data

    def _get_bg_image_comparison_data(self):
        """
        """
        data = (
            self.graphicsMode,
                # often too conservative, but not always
                # bug: some graphicsModes use prefs or PM settings to decide
                # how much of the model to display; this ignores those
                # bug: some GMs do extra drawing in .Draw; this ignores prefs etc that affect that
            self._fog_test_enable,
            self.displayMode, # display style
            self.part,
            self.part.assy.all_change_indicators(), # TODO: fix view change indicator for this to work fully
                # note: that's too conservative, since it notices changes in other parts (e.g. from Copy Selection)

            # KLUGE until view change indicator is fixed -- include view data
            # directly; should be ok indefinitely
            + self.quat, # this hit a bug in same_vals (C version), fixed by Eric M 080922 in samevalshelp.c rev 14311
            ## + self.quat.vec, # workaround for that bug (works)
            + self.pov, self.scale, self.zoomFactor,
            
            self.width,
            self.height,
            QGLWidget.width(self), # in case it disagrees with self.width
            QGLWidget.height(self),
            self._resize_counter, # redundant way to force new grab after resize
                # (tho it might be safer to completely disable the feature
                #  for a frame, after resize ### TRYIT)
            self.ortho,
           )
        return data
开发者ID:pmetzger,项目名称:nanoengineer,代码行数:31,代码来源:GLPane_image_methods.py

示例6: mousePressEvent

    def mousePressEvent(self, event):
        if event.button() == QtCore.Qt.LeftButton:
            self.mousePressEventLeft(event)
        elif event.button() == QtCore.Qt.RightButton:
            self.mousePressEventRight(event)

        QGLWidget.mousePressEvent(self, event)
开发者ID:SCIInstitute,项目名称:MLM,代码行数:7,代码来源:ui.py

示例7: __init__

    def __init__(self, viewer, parent, texture_file):
        QGLWidget.__init__(self)
        threading.Thread.__init__(self)

        self.texture_file = texture_file
        self.program_active = True
        self.mouse_origin = 0
        self.alpha = .2
        self.mouse_pos = None

        self.x_ticks = 0
        self.y_ticks = 0

        self.view = viewer.get_View()
        self.data_sets = viewer.get_Data()
        self.title = viewer.get_Title()
        self.tool_qb = ToolQB()
        self.rubberband = RectRubberband()
        self.setMouseTracking(True)
        self.prevView = None

        self.kd_tree = []
        self.kd_tree_active = False
        self.graphicsProxyWidget()
        self.scale_x = 0
        self.scale_y = 0
        self.width = 0
        self.height = 0
        self.ratio = 0
        self.orig_kd_tree = None
        self.lock = thread.allocate_lock()
        self.parent = parent

        # Starts the thread of anything inside of the run() method
        self.start()
开发者ID:SCIInstitute,项目名称:MLM,代码行数:35,代码来源:widget.py

示例8: _init_specific

    def _init_specific(self, p, kwargs):

        # Deal with config
        glformat = _set_config(p.context.config)
        glformat.setSwapInterval(1 if p.vsync else 0)
        # Deal with context
        widget = kwargs.pop('shareWidget', None) or self
        p.context.shared.add_ref('qt', widget)
        if p.context.shared.ref is widget:
            if widget is self:
                widget = None  # QGLWidget does not accept self ;)
        else:
            widget = p.context.shared.ref
            if 'shareWidget' in kwargs:
                raise RuntimeError('Cannot use vispy to share context and '
                                   'use built-in shareWidget.')

        # first arg can be glformat, or a gl context
        if p.always_on_top or not p.decorate:
            hint = 0
            hint |= 0 if p.decorate else QtCore.Qt.FramelessWindowHint
            hint |= QtCore.Qt.WindowStaysOnTopHint if p.always_on_top else 0
        else:
            hint = QtCore.Qt.Widget  # can also be a window type
        QGLWidget.__init__(self, glformat, p.parent, widget, hint)
        self._initialized = True
        if not self.isValid():
            raise RuntimeError('context could not be created')
        self.setAutoBufferSwap(False)  # to make consistent with other backends
        self.setFocusPolicy(QtCore.Qt.WheelFocus)
开发者ID:Eric89GXL,项目名称:vispy,代码行数:30,代码来源:_qt.py

示例9: __init__

    def __init__(self, parent=None):
        self.logger = logging.getLogger('pyforms')
        QGLWidget.__init__(self, parent)
        self.image2Display = []
        self.texture = []
        self.setMouseTracking(True)
        self.zoom = 1.0
        self._mouseX = 0.0
        self._mouseY = 0.0
        self._glX = 0.0
        self._glY = 0.0
        self._glZ = 0.0
        self._lastGlX = 0.0
        self._lastGlY = 0.0
        self._mouseDown = False
        self._mouseLeftDown = False
        self._mouseRightDown = False
        self._width = 1.0
        self._height = 1.0
        self._x = 0
        self._y = 0
        self.imgWidth = 1
        self.imgHeight = 1

        self._rotateZ = 0
        self._rotateX = 0

        self._mouseStartDragPoint = None
        # Message to show on the left corner of the screen
        self._helpText = None

        self.setMinimumHeight(100)

        self._point = None
        self._pendingFrames = None
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:35,代码来源:VideoGLWidget.py

示例10: __init__

	def __init__(self, parent=None):
		QGLWidget.__init__(self, parent)

		self._image2Display = []
		self._texture = []          #: Opengl texture variable
		self._zoom = 1.0
		self._mouseX = 0.0
		self._mouseY = 0.0
		self._width = 1.0
		self._height = 1.0
		self._glX = 0.0
		self._glY = 0.0
		self._glZ = 0.0
		self._x = 0.0
		self._y = 0.0
		self._lastGlX = 0.0
		self._lastGlY = 0.0
		self._mouseDown = False
		self._mouseLeftDown = False
		self._mouseRightDown = False

		self._mouseStartDragPoint = None
		
		self.setMinimumHeight(100)
		self.setMouseTracking(True)
开发者ID:UmSenhorQualquer,项目名称:pyforms,代码行数:25,代码来源:ControlImage.py

示例11: glDraw

    def glDraw(self):
        QGLWidget.glDraw(self)
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
        glLoadIdentity()
        #        glTranslatef(0.0, -26.0, -100.0)

        fps = time() - self.timer
        self.renderText(20, 20, "Test! %d" % fps)

        glRotatef(self.rotation['x'], 1, 0, 0)
        glRotatef(self.rotation['y'], 0, 1, 0)
        glRotatef(self.rotation['z'], 0, 0, 1)
        glScalef(self.scale, self.scale, self.scale)

        #
        # glBegin(GL_QUADS)
        # glVertex2f(0, 0)
        # glVertex2f(10, 0)
        # glVertex2f(10, 10)
        # glVertex2f(0, 10)
        # glEnd()

        self.timer = time()
        self.drawfloor()
        for s in self.stl:
            s.draw()
开发者ID:wadoon,项目名称:stlviewer,代码行数:26,代码来源:__init__.py

示例12: __init__

 def __init__(self, figure):
     FigureCanvasQT.__init__(self, figure)
     QGLWidget.__init__(self)
     self.drawRect = False
     self.rect = []
     self.blitbox = None
     self.setAttribute(QtCore.Qt.WA_OpaquePaintEvent)
开发者ID:ChrisBeaumont,项目名称:mplgl,代码行数:7,代码来源:opengl_backend.py

示例13: __init__

 def __init__(self):
     QGLWidget.__init__(self)
     self.setFocusPolicy(QtCore.Qt.StrongFocus)
     self.count = 0
     self.makeData()
     self.idleTimer = QtCore.QTimer()
     self.idleTimer.timeout.connect(self.iterate)
     self.idleTimer.start(0)
开发者ID:mickp,项目名称:glStuff,代码行数:8,代码来源:interacting.py

示例14: mousePressEvent

	def mousePressEvent(self, event):
		QGLWidget.mousePressEvent(self, event)
		self.__updateMouse(event, pressed = True)
		self.repaint()

		if self._mouseLeftDown:  self._mouseStartDragPoint = self._mouseGLPosition
		if self._mouseRightDown: self._lastMouseGLPosition = self._mouseGLPosition

		self.onPress( event.button(), self._mousePosition, self._mouseGLPosition )
开发者ID:AlfiyaZi,项目名称:pyforms,代码行数:9,代码来源:ControlOpenGL.py

示例15: __init__

    def __init__(self, parent):
        QGLWidget.__init__(self, parent)
        self.setMinimumSize(200, 200)
#        glutInit()#sys.argv)
        self.coords = {1:None, 2:None}
        self.minima = {1:None, 2:None}
        self.last_mouse_pos = QtCore.QPointF(0., 0.)
        self.rotation = rot.aa2mx(np.array([0.,0.,0.])) # np.array([0., 0.])
        self.zoom = 1.0
        self._fatal_error = False # don't try to plot if it won't work
开发者ID:Mahdisadjadi,项目名称:pele,代码行数:10,代码来源:show3d.py


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