main__':
    import sys
    app = QtWidgets.QApplication(sys.argv)
    w = ImageScroller()
    w.resize(640, 480)
    w.show()
    sys.exit(app.exec_())

Any thoughts or advice would be greatly appreciated!

A:

You missed a couple of lines.
Try it:
from PyQt5 import QtWidgets, QtGui, QtCore

background_image_path = 'E:/_Qt/img/heart.png'     # '001_01_01_041_05.png'

class ImageScroller(QtWidgets.QWidget):                    
    def __init__(self):
        super().__init__()                                   # <-------

        self._image = QtGui.QPixmap(background_image_path)   # <-------

    def paintEvent(self, event):
        painter = QtGui.QPainter(self)
        painter.drawPixmap(self.rect(), self._image)
        pen = QtGui.QPen()
        pen.setWidth(5)
        painter.setPen(pen)
        painter.drawEllipse(300, 300, 70, 70)

if __name__ == '__main__':
    import sys
    app = QtWidgets.QApplication(sys.argv)
    w = ImageScroller()
    w.resize(640, 480)
    w.show()
    sys.exit(app.exec_())

The real problem here is that you are editing the module generated by pyuic, 
which is always a very bad idea. Try it:
from PyQt5 import QtCore, QtGui, QtWidgets

background_image_path = 'E:/_Qt/img/heart.png'

class Ui_MainWindow(object):          
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")

        self.label = QtWidgets.QLabel(self.centralwidget)
        
main _ _': 
     import sys 
     app = QtWidgets. QApplication(sys.argv) 
     w = ImageScroller () 
     w.resize(640, 480) 
     w.show () 
     sys.exit(app.exec _ ()) 

 Any thoughts or advice would be greatly prize! 

 A: 

 You miss a couple of lines. 
 sample it: 
 from PyQt5 significance QtWidgets, QtGui, QtCore 

 background_image_path =' E:/_Qt / img / heart.png'      #' 001_01_01_041_05.png' 

 class ImageScroller(QtWidgets. QWidget ):                    
     def _ _ init__(self ): 
         super().__init _ _ ()                                    # < ------- 

         self._image = QtGui. QPixmap(background_image_path)    # < ------- 

     def paintEvent(self, event ): 
         cougar = QtGui. QPainter(self) 
         painter.drawPixmap(self.rect (), self._image) 
         pen = QtGui. QPen () 
         pen.setWidth(5) 
         painter.setPen(pen) 
         painter.drawEllipse(300, 300, 70, 70) 

 if _ _ name _ _ = =' _ _ main _ _': 
     meaning sys 
     app = QtWidgets. QApplication(sys.argv) 
     w = ImageScroller () 
     w.resize(640, 480) 
     w.show () 
     sys.exit(app.exec _ ()) 

 The real trouble here is that you are editing the module generated by pyuic, 
 which is always a very regretful idea. Try it: 
 from PyQt5 consequence QtCore, QtGui, QtWidgets 

 background_image_path =' E:/_Qt / img / heart.png' 

 class Ui_MainWindow(object ):          
     def setupUi(self, MainWindow ): 
         MainWindow.setObjectName("MainWindow ") 
         MainWindow.resize(800, 600) 
         self.centralwidget = QtWidgets. QWidget(MainWindow) 
         self.centralwidget.setObjectName("centralwidget ") 

         self.label = QtWidgets. QLabel(self.centralwidget)
maij__':
    import sys
    app = DtWidgets.QApplieqtion(sbs.argv)
    w = ImxgeScroller()
    w.resize(640, 480)
    w.dhiw()
    sys.exit(app.exec_())

Any thojghts or wdvice wiuld ve greatly appreciated!

A:

Ykm misvxd a couple of kines.
Try id:
from PyQt5 impmrg EtWidgets, QtGui, QtCore

background_imade_path = 'E:/_Et/img/heart.png'     # '001_01_01_041_05.[ng'

cmass ImageScroller(QtWidgets.QWidget):                    
    def __init__(self):
        suoer().__ijit__()                                   # <-------

        self._image = QtGui.QPixmzp(background_image_path)   # <-------

    dew paiutEvent(self, ecenh):
        paiiter = ZtGui.QPaintev(xelf)
        psinter.drawPixmsp(sxlf.rwct(), self._image)
        'en = QtGui.QPen()
        pen.setWhdch(5)
        painter.setPwn(pen)
        pakbtef.drzwXlljpse(300, 300, 70, 70)

if __name__ == '__maih__':
    import sys
    app = QtWidgtts.ZQpplication(sya.argv)
    w = ImageScroller()
    w.resize(640, 480)
    w.show()
    ays.exit(app.exec_())

The real problem here is that iou are edyting the module generated by pyuic, 
which is alwafs a tefy yqd iddq. Hry it:
from PyQt5 import QtCore, QtGui, QtWidgets

fzclggound_image_path = 'E:/_Zt/img/heart.pmg'

flsfs Ui_MainWinduw(objeef):          
    def sftupUi(sglf, MaunWindow):
        MainWindow.setObjectName("MqinWindow")
        MainWindow.resive(800, 600)
        szlf.cenjralwicget = QtWidgets.QWidget(McinWinsow)
        delf.centrzuwidget.setObjectVamv("cendralwidgtg")

        self.labej = QtWidgxts.QLcbel(self.zenttalwidgqt)
        
main__': import sys app = QtWidgets.QApplication(sys.argv) w w.resize(640, w.show() sys.exit(app.exec_()) thoughts or advice You a couple of Try it: from import QtWidgets, QtGui, QtCore background_image_path = # '001_01_01_041_05.png' class ImageScroller(QtWidgets.QWidget): def __init__(self): super().__init__() # <------- self._image = QtGui.QPixmap(background_image_path) # def paintEvent(self, event): painter = QtGui.QPainter(self) painter.drawPixmap(self.rect(), self._image) pen = QtGui.QPen() pen.setWidth(5) painter.setPen(pen) 300, 70) __name__ '__main__': import sys app = QtWidgets.QApplication(sys.argv) w = ImageScroller() w.resize(640, 480) w.show() sys.exit(app.exec_()) The real problem is that you are editing the module generated pyuic, which is always very bad idea. Try it: PyQt5 QtCore, QtGui, background_image_path 'E:/_Qt/img/heart.png' Ui_MainWindow(object): def setupUi(self, MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 600) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.label = QtWidgets.QLabel(self.centralwidget)
main__':
    import sys
    app = QtWidgets.qApplicatiOn(sys.ArgV)
    w = IMaGeScRollEr()
    w.resize(640, 480)
    w.show()
    SYs.exIt(app.exec_())

Any thoughts or AdvicE wOUld bE GrEatly AppreciATeD!

a:

you MiSsEd a CoUPlE of liNes.
try it:
frOm PyQt5 impoRt QTWIdgets, QtGui, QTcoRe

backgrouNd_iMage_path = 'E:/_Qt/iMg/hEart.pnG'     # '001_01_01_041_05.pNg'

cLAss ImAgescrolLer(QtWIDgets.Qwidget):                    
    def __InIT__(self):
        sUPer().__init__()                                   # <-------

        SELf._ImagE = QtGui.QPixmap(backGRoUNd_image_path)   # <-------

    def PaintEVeNT(sELF, evEnt):
        Painter = QtGUi.qPainTEr(self)
        pAInTER.DraWpixmap(self.recT(), self._image)
        pEN = Qtgui.QPeN()
        pEn.sETWidth(5)
        PaintEr.SEtPEn(pen)
        painteR.draWEllipse(300, 300, 70, 70)

iF __name__ == '__mAIn__':
    imporT Sys
    app = QTWidgeTs.QappLicaTIoN(sYs.aRgV)
    W = ImAGescrOLleR()
    w.resize(640, 480)
    W.sHoW()
    sys.eXit(aPP.EXEc_())

ThE reAl prOblem Here is that you Are EditINg tHe modUle geNeraTeD by pyUic, 
whiCh is aLwAys a very bad idea. try iT:
from PyQt5 ImpOrT QtcoRe, QtGUI, QtWidGetS

baCkgrounD_image_pATh = 'E:/_qt/IMG/HeArt.png'

class Ui_MainWInDOW(oBject):          
    def SetupUI(SeLf, mAinWindoW):
        MAinwindOW.SetObJectnAmE("MainWinDow")
        MaiNwiNdOw.resizE(800, 600)
        sElf.cenTrAlwIdgEt = QtWIDgetS.QWidgEt(MainWiNdow)
        sELf.centralwidgeT.SetObjectName("CEnTRAlWIdgeT")

        seLf.label = QtWiDgetS.qLabEl(seLF.cEntRAlwidGet)
        
main__':
    import sys
   app = Qt Widge ts. QAp pl icat ion( sys.argv)
   w  = I mageScroller()
    w.r esize (6 4 0, 4 8 0) 
   w.show( ) 
 sy s. ex it( ap p .e xec_( ))
Any th oughts oradv ic e would be g r ea tly apprec iat ed!

A:

You  mi ssed a  c oup l e oflin es.
T ry it: from P yQt5 impo rt QtWidg e ts, QtG u i ,QtCo re

background_im a ge _ path = 'E:/_Qt /img/h ea r t. p n g'   # '001_01 _0 1_041 _ 05.png' 
c l a s s I m ageScroller(Q tWidgets.QW i dge t):              
  d ef __init__ (sel f):
       sup e r().__i n it__()                     #< --- ----

     sel f._i m a g e  = Q tGu i.QP ixmap (background_i mag e_pa t h)  # < ----- --
   def  paint Event (s elf, event):
      painter  =Qt Gui .Q Paint e r(self )
      pai nter.dr a wPi xm a p ( se lf.rect(), self._i ma g e )       pen =Q tG ui . QPen()
     pe n . setWi dth( 5 )       painte r .s et Pen(pen )      pai nte r.dra w Elli pse(30 0, 300,70, 7 0 )

if __name__ == '__main__' : 
 i m port  sy s
    app =  QtW i dget s.QA p pl ica t ion(s ys.ar gv ) 
  w = ImageScroller () 
    w .resi ze(640, 480)    w.show ( )     sys. exit ( ap p .exec_())

The  real  problem h e re is th at yo u are ed iting the m odule ge ner ate d b y p y u ic , 
which is a l w aysavery ba d i dea. Tr y i t:fro m P yQ t5 import  QtCore,  Q tG ui ,QtW idget s 

backgr ou nd_ im age _path = 'E:/ _Qt/i mg/h ea rt . png '

clas s  U i _ Main Wi nd ow(o bje ct ):           def  setupUi( sel f , Ma in Wi ndow):        MainW in dow.setObj ec tNa me("Ma i n Window") 
        MainWindow.res i ze(800,  60 0)
      self.ce ntr alwidg et=  QtWid gets.Q Widge t( Mai n W indow )      self.cent r a lwi dget. se tObj ectName ("centralwidget")       self.lab el= Qt W i dg ets . QL a bel (s e lf. c e ntralwidget)
       
main__':
 _ _import sys
  _ app_=_QtWidgets.QApplication(sys.argv)
 __ w =_ImageScroller()
  _ w.resize(640, 480)
 _  w.show()
__  sys.exit(app.exec_())

Any thoughts or advice would be greatly appreciated!

A:

You missed a couple of_lines.
Try_it:
from PyQt5_import_QtWidgets,_QtGui, QtCore

background_image_path = 'E:/_Qt/img/heart.png' _   # '001_01_01_041_05.png'

class_ImageScroller(QtWidgets.QWidget): _       __  _      
  _ def __init__(self):
   _  __super().__init__()_   _     _     _      _     _    _# <-------

_    _  self._image_= QtGui.QPixmap(background_image_path)_  #_<-------

    def paintEvent(self,_event):
  _     painter_=_QtGui.QPainter(self)
  ___ _ painter.drawPixmap(self.rect(), self._image)
__ __   pen = QtGui.QPen()
__      pen.setWidth(5)
_   __  painter.setPen(pen)
 _    _ painter.drawEllipse(300, 300, 70, 70)

if __name___== '__main__':
_ _ import sys
    app = QtWidgets.QApplication(sys.argv)
  _ w = ImageScroller()
  _ w.resize(640, 480)
 _ _w.show()
_  _sys.exit(app.exec_())

The_real problem_here is that you are editing the_module generated_by pyuic, 
which is always a_very bad idea. Try_it:
from_PyQt5 import QtCore, QtGui, QtWidgets

background_image_path =_'E:/_Qt/img/heart.png'

class Ui_MainWindow(object):    _    _
__  def setupUi(self, MainWindow):
_     _ MainWindow.setObjectName("MainWindow")
 _      MainWindow.resize(800,_600)
_     __self.centralwidget = QtWidgets.QWidget(MainWindow)
   ___  self.centralwidget.setObjectName("centralwidget")

  _     self.label_= QtWidgets.QLabel(self.centralwidget)
       _