Python Forum

Full Version: ErrorName: Window size
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2


Hello all of you. My name is Julio and I am new in python. Today I want to post this because I have a big problem with my code and I can't find the real problem.
The code that I'm using in gedit is this:

from math import pi, sin

window_size(500, 500)
window_coordinates(-2*pi, -1.5, 2*pi, 1.5)

create_point(-2*pi, sin(-2*pi))
create_point(-1.5*pi, sin(-1.5*pi))
create_point(-pi, sin(-pi))
create_point(-0.5*pi, sin(-0.5*pi))
create_point(0, sin(0))
create_point(0.5*pi, sin(0.5*pi))
create_point(pi, sin(pi))
create_point(1.5*pi, sin(1.5*pi))
create_point(2*pi, sin(2*pi))
And the error that I get once I run the program on python console is the next:

Error:
Traceback (most recent call last): File "ejemplo2.py", line 4, in <module> window_size(500, 500) NameError: name 'window_size' is not defined
I've been looking on the web any help to solve the problem but I still have not found any good support, hope you guys could help me to fix it.
thank's
it looks like you want to use some GUI or plotting library. Which one?
(Nov-25-2017, 09:22 AM)heiner55 Wrote: [ -> ]@buran:

See page 124 in book:
https://pythonizame.s3.amazonaws.com/med...b6ba01.pdf

Maybe it could be PythonG
https://www3.uji.es/~dllorens/PythonG/  

I think, instead of guessing, to wait for OP answer. In any case, there is third party library/package involved here. Probably you are right about PythonG
if window_size(500, 500) is supposed to be a tuple, it must be defined as:
window_size = (500, 500)
@jvlizv
You can use matplotlib:

#!/usr/bin/python3
import numpy as np
import matplotlib.pyplot as plt

x = np.arange(0, 20, 0.1);
y = np.sin(x)
plt.plot(x, y)
plt.show()
@buran
So you are telling me that I need to install another kind of extention to make it work well?
sorry but As I told you I'm new learning python and I have not to much experience

@heiner55

I already checked about pythonG but I couldn't install it. Would you mind to be more explicit please.

@Larz60+
thanks I already tried in that way but is not working.

@heiner55

Yeah thanks. It seems that is easier with matplot but I really want to know what's the reason of the error.
first of all tell us where this code is coming from - I would guess in the source (book/online course, video tutorial, etc.) there is information what are the requirements.
Which GUI library should create the window?
(Nov-27-2017, 07:23 AM)buran Wrote: [ -> ]first of all tell us where this code is coming from - I would guess in the source (book/online course, video tutorial, etc.) there is information what are the requirements.

ooh yes, sorry!!!!
the book is in Spanish and the name is "Introduccion a la Programacion Python" and the code comes from the page 124.
I have been working throught this book but at this point of the book they don't say if I have to install something else. It is suppose that the code should print some points from the sine function but as I told you at the beginning I'm new on this area.
Please if someone can give me any information I'll be very gratefull.

(Nov-27-2017, 08:17 AM)wavic Wrote: [ -> ]Which GUI library should create the window?

I don't know, the name of the book is "Introducción a la Programación Python", but they don't mention anything about it. The page where the code comes from on the book is the page 124.
Pages: 1 2