Hello Community,

using background image in QtApp causes pythonOCC to run very slow.(move, pan, 
rotate, etc..)
therefore, i must use only background color until i figure it out how to set 
gradient color :)

nevermind,i think there is a problem with my intel graphic card.

hier is code, but please note: 
in case you already set background image for example 'default_background.bmp',
you must set new 'dummy_background.bmp' (1px x 1px) with option Stretch=False
and only after that you can apply new background color. 

p.s. i made "dummy_background.bmp" please find attached and put this file in 
/OCC/Display 

#
# QColorDialog class provides a dialog widget for specifying colors.
#
def set_background_color( self ):
    color=QtGui.QColorDialog.getColor()
        if( color.isValid() ):
            R = color.red() / 255.
            G = color.green() / 255.
            B = color.blue() / 255.
            print "%f: %f: %f" % (R, G, B)
            self.SetBackgroundImage( self.get_dummy_bg_abs_filename(), 
Stretch=False ) 
            self.View.SetBackgroundColor( Quantity_TOC_RGB, R1, G1, B1 )
        self.Repaint()

def get_dummy_bg_abs_filename ( self ):
        occ_package = sys.modules['OCC']
        dummy_bg_abs_filename = os.path.join( occ_package.__path__[0], 
'Display', 'dummy_background.bmp' )
        if not os.path.isfile( dummy_bg_abs_filename ):
            raise NameError( 'No image dummy found.' )
        else:
            return dummy_bg_abs_filename





<<attachment: dummy_background.bmp>>

_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to