Why windows user affects how built python application calls pyside/pyqt paintEvent?
<p>I've built python 3.3 application using pyqt4 and cx_freeze under windows user 'user1'. </p>

<p>If I run exe as windows 'user1' everything works.
If I run exe as windows 'user2' buttons in app are in wrong positions. I've figured out that widgets paintEvent is not being called (that's where i position buttons - don't ask why :)).</p>

<p>Any ideas why paintEvent method would be called differently just because different windows user is running exe?</p>

<p>Thank you for any insight!</p>

<p>UPDATE:</p>

<p>I seems that a single line is the problem. Take a look at commented out line in init method of MainWindow class (test3.py). At the bottom I attached images showing what happens for different windows users running compiled exe if this line (un)commented.</p>

<p><strong>Why is this happening?</strong></p>

<p>test3.py code to recreate the problem:</p>

<pre><code>from PyQt4 import QtGui as pqg
from PyQt4 import QtCore as pqc
import sys
import pyqtgraph.opengl as gl
from pyqtgraph.opengl.shaders import *
import numpy as np

class AnimWidgBase(pqg.QWidget):
    def __init__(self, *args, **kwargs):
        super(AnimWidgBase, self).__init__(*args, **kwargs)

        # Create 3D graphics widget
        self.model_view = GLView()

        # Create layout and add widgets
        self.create_layout()

    def create_layout(self):
        vbox = pqg.QVBoxLayout()
        vbox.addWidget(self.model_view)
        self.setLayout(vbox)

class GLView(gl.GLViewWidget):
    def __init__(self, parent=None):
        super(GLView, self).__init__(parent)
        self.setSizePolicy(pqg.QSizePolicy.Expanding, pqg.QSizePolicy.Expanding)
        self.default_width = 500
        self.default_height = 500
        self.setMinimumSize(pqc.QSize(self.default_width, self.default_height))

    def paintGL(self, *args, **kwargs):
        gl.GLViewWidget.paintGL(self, *args, **kwargs)

        #for testing
        self.loc=np.array([[1,1,1],[2,2,2],[3,3,3]])
        self.data=np.array(['1','2','3'])

        #print gcs labels
        for i in [0,1,2]:
            self.renderText(self.loc[i,0], self.loc[i,1], self.loc[i,2],self.data[i])

class GeometryWidget(AnimWidgBase):

    def __init__(self, *args, **kwargs):
        super(self.__class__, self).__init__(*args, **kwargs)

    def create_layout(self):
        super(self.__class__,self).create_layout()
        self._button = pqg.QPushButton('Test button', self)

    def paintEvent(self,event):
        # Position the button so that it moves when resizing
        window_width=self.rect().width()
        window_height=self.rect().height()
        w = 140 #this is overridden by css
        h = 33
        x = (window_width  - w)
        y = 0.2*window_height
        self._button.setGeometry(x,y,w,h)


class MainWindow(pqg.QFrame):
    """Main window of the application.
    """
    def __init__(self):
        """Constructor, builds the GUI."""
        super(MainWindow, self).__init__()
        self.stacked_widget = pqg.QStackedWidget()
        self.vbox_gobal = pqg.QVBoxLayout()
        self.vbox_gobal.addWidget(self.stacked_widget)
        self.setLayout(self.vbox_gobal)

        self.load_geometry()

        # Uncomment this line to prevent GeometryWidget paintEvent being called !
        #self.stacked_widget.setContentsMargins(-10, -10, -10, -10)
        # -----------

    def load_geometry(self):
        self.geom_widg=GeometryWidget()
        self.stacked_widget.addWidget(self.geom_widg)
        self.stacked_widget.setCurrentWidget(self.geom_widg)


def main():
    app = pqg.QApplication(sys.argv)
    app.processEvents()
    main_window = MainWindow()
    app.processEvents()
    main_window.show()
    return sys.exit(app.exec_())

if __name__ == '__main__':
    main()
</code></pre>

<p>Here is setup.py:</p>

<pre><code>from cx_Freeze import setup, Executable

base = None

options = {
    'build_exe': {
        'packages': ['OpenGL'],
        'includes': ['PyQt4'],

    },

}

executables = [
    Executable('test3.py', base=base)
]

setup(name='test',
      version='0.1',
      description='test for testing tests',
      options=options,
      executables=executables
      )
</code></pre>

<p>User1, offending line commented:
<a href="https://i.stack.imgur.com/mIdtH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mIdtH.png" alt="User1, offending line commented"></a></p>

<p>User1, offending line UNcommented:
<a href="https://i.stack.imgur.com/rdOZe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rdOZe.png" alt="User1, offending line UNcommented"></a></p>

<p>User2, offending line commented:
<a href="https://i.stack.imgur.com/uccQ1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uccQ1.png" alt="User2, offending line commented"></a></p>

<p>User2, offending line UNcommented:
<a href="https://i.stack.imgur.com/GDeW2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GDeW2.png" alt="User2, offending line UNcommented"></a></p>