Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 627055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:29:12+00:00 2026-05-13T19:29:12+00:00

From research on Stack Overflow and other sites I’m 99% sure that the problem

  • 0

From research on Stack Overflow and other sites I’m 99% sure that the problem I’m having is due to incorrect importing. Below is a QLabel sub class that I’m using to respond to some mouse events:

import Qt
import sys

class ASMovableLabel(Qt.QLabel):

    def mouseReleaseEvent(self, event):

        button = event.button()
        if button == 1:
            print ('LEFT CLICK')

    def mousePressEvent(self, event):

        button = event.button()
        if button == 1:
            print ('LEFT CLICK')
        elif button == 3:
            print ('RIGHT CLICK')
            self.setLayout()

    def mouseMoveEvent(self, event):
        print ("you moved the mouse: %f, %f", event.x, event.y)
        self.frameRect.setTopLeft(Qt.QPoint(event.x, event.y))

When mouseMoveEvent is triggered I get the following error:

    self.frameRect.setTopLeft(Qt.QPoint(event.x, event.y))
AttributeError: 'builtin_function_or_method' object has no attribute 'setTopLeft'

The other solutions to this type of error I’ve seen have revolved around the name space, so I would or would not need to include Qt. before all the Qt classes but this error is much farther down in the Qt objects. Please point out my mistake!

I have also tried:

from PyQt4 import Qt

It gives the same error

UPDATE: based on Messa’s comment I made few changes:

import Qt
import sys

class ASMovableLabel(Qt.QLabel):

    def mouseReleaseEvent(self, event):

        button = event.button()
        if button == 1:
            print ('LEFT CLICK')

    def mousePressEvent(self, event):

        button = event.button()
        if button == 1:
            print ('LEFT CLICK')
        elif button == 3:
            print ('RIGHT CLICK')
            self.setLayout() #this won't set to nil

    def mouseMoveEvent(self, event):
        self.frameRect().setTopLeft(Qt.QPoint(event.globalX(), event.globalY()))

So it seems that in Python the dot syntax are function calls and need to include that trailing “()“. This doesn’t include self ( i.e. self().something() )

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:29:12+00:00Added an answer on May 13, 2026 at 7:29 pm

    Try

    self.frameRect().setTopLeft(Qt.QPoint(event.x, event.y))
    

    instead of

    self.frameRect.setTopLeft(Qt.QPoint(event.x, event.y))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From my research, I know that I cannot use HTML input file to get
I've done some research on using tags from social bookmarking sites for web search
I have this original formula from a medical research book: Log(e) (EFW) = (-4.564+(0.282*AC)-(0.00331*AC^2))*1000
I am working on a research project with baseball data from retrosheet.org. I want
I’m looking at creating a P2P system. During initial research, I’m reading from Peer-to-Peer
i have a problem and confused a little bit. I made some research in
I'm having difficulty figuring out how to make the jump from a Scala high-order
this is my first question on Stack Overflow. This is not really a programming
I am new to Stack Overflow and am teaching myself C++, but am still
From my website, I have a button which calls a method and then generates

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.