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

  • Home
  • SEARCH
  • 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 9016391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:59:01+00:00 2026-06-16T03:59:01+00:00

I have a class, nothing special, just a regular class: class WINDOW (): def

  • 0

I have a class, nothing special, just a regular class:

class WINDOW ():
    def __init__ (self, path):
        ...some unrelated codd...
        self.win = newwin(stdscr.win.getmaxyx() [0]-2, stdscr.win.getmaxyx() [1], 0, 0)
        self.xmax = self.win.getmaxyx() [1]
        self.ymax = self.win.getmaxyx() [0]

    def draw(self,flin,fcol):
        ...code here
        i = 0
        while i < self.ymax -1:
            ...more code here...

When I try to access “self.ymax” in the while loop, I get error, saying that classs WINDOW has no atribute ymax.
What have I done wrong???

Edit:
getmaxyx() returns a tuple of two values.
This is a curses program. I’m using python 3.

Edit 2:
More code – creating an instance of WINDOW:

def main():
    global stdscr
    stdscr = initscr()
    global interface

    interface = INTERFACE(stdscr)
    interface.wins.append(WINDOW(parseArgv()))

    dispatcher()

Parseargv():

def parseArgv():
    #arguments are [filename, PathToFileThatThisProgramOpens]
    if len(argv) == 1:
        return None
    else:
        return argv[-1]

calling draw():

def SwitchWindow(self):
    self.wins[self.currentWindow].empty()
    self.currentWindow += 1 #select next window
    line = self.wins[self.currentWindow].flin
    coll = self.wins[self.currentWindow].fcol
    self.wins[self.currentWindow].draw(line,coll)
  • 1 1 Answer
  • 0 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-06-16T03:59:02+00:00Added an answer on June 16, 2026 at 3:59 am

    Without the full code and traceback it’s impossible to tell, but I have some guesses at the problem:

    1. The bit replaced by ...some unrelated codd... actually contains multiple code paths and the code we do see is only executed some of the time so self.ymax isn’t always initialised.
    2. Either ...code here or ...more code here... rebinds the name self within the draw() method.
    3. majTheHero retyped her/his code instead of using copy and paste and in doing so inadvertently corrected a misspelling of ymax in one of the places it is used.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently started making a C++ Wrapper of GTK+ (Nothing special, just wrapping
I have a class called Property which has nothing but get -methods. All the
I just realize some of my classes have no members. It has several public
I have Class and Student objects. Both have collection of another as property. Which
I have class LegacyClass which inherits OldBaseClass. I'm considering a change to introduce a
I have class that extend FragmentActivity in it I add fragment to layout as
I have class grades that I need to check if a specific grade is
I have class with back reference: public class Employee : Entity { private string
I have class with collection as below public class MyClass:IXmlSerializable { int vesrion; private
I have class Meat extends Food { $var = Food::foodFunction… } I need to

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.