2019-05-09 20:05:32 (edited by sito 2019-05-09 20:06:23)

hello! The python documentation is really to my liking. I like the way they show examples so that you really know the syntax and the results well. A question though, since i'm farily new i was wondering if there's a page that have exercises based of the python documentation? haven't been able to find one yet.

2019-05-09 22:19:50 (edited by keithwipf1 2019-05-09 22:20:12)

There is a Python howto section that has code snippets. It's in the main Python documentation.

2019-05-09 22:22:37

The documentation is largely for reference or examples, if your looking specifically for exercises to practice on, you should check out some books like [How To Think Like A Computer Scientist] or the [Python Practice Book], both have exercises after each chapter to work with. There's others around of course, but another good way to learn is to start a project and work through the problems that come up when working on it.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2019-05-10 13:29:43

Yeah. Just that it's good to being able to solve common problems and algoryttems and memmorize the syntax of slicing for example

2019-05-12 01:26:36

@magorp stop recommending how to think like a computer scientist. it's all graphical stuff later on in the book which blind people can't do

2019-05-12 03:20:32 (edited by magurp244 2019-05-12 03:47:53)

@5
Out of 27 chapters, about 7 use a combination of python.turtle and Pygame, and mostly to demonstrate concepts. Those chapters also aren't solely at the end of the book, but more distributed throughout. Its difficult to say whether some users may have more trouble grappling with it than others, as blindness can be a spectrum, and others have demonstrated the capability to create GUI's programatically through geometric planning without being able to see the screen at all.

I understand that you and others might not see much of a point to it, or find it frustrating, the book might not describe some concepts and functions that it takes for granted with a more sighted reader. Whether you find any value in those chapters or not, you can always skip them and read the others, taking what you want out of it. That in and of itself can be a useful skill if your pouring over large amounts of dry API documentation for useful functions in the future. If you have any questions about the graphical chapters though, feel free to ask.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2019-05-12 08:04:15

that explains a lot.

2019-05-12 08:07:14

just seeing all the graphical stuff when I got to it just made me rage the hell out lol. going to just skip it though. that said is there anything in those chapters that should be read? not sure if reading any of that stuff would help in the future or if I should just skip it entirely.

2019-05-12 09:58:17 (edited by magurp244 2019-05-12 10:04:30)

Chapters 3, 4, 5, and 10 either deal with turtle or have examples with it, Chapters 17 and 18 mostly have pygame. Chapters 7, 19, and 23 only have a few exercises at the end of the chapters that involve using either turtle or pygame.

Chapter 3 shows how to use turtle, which initially might seem difficult, but turtle functions very much like an NPC character that you can move around and command like you would in any game, including audiogames. In order to interact with it, you should use "turtle.pos()", or "turtle.position()", which will return its x and y coordinates on the screen, and "turtle.heading()" for the angle its facing. You can check its full list of commands [here], which might make working with the exercises a bit easier from a mathematics or geometry perspective. Another part of the chapter covers the For Loop, so if you want to skip everything about Turtle, you should head to the part about For loop, along with the for loop specific exercises.

Chapter 4 covers functions, most of it is demonstrated with turtle drawing geometric shapes, though the graphics are less relevant than the math their based on. If you have a difficult time groking it, you can skip this chapter and read up on functions elsewhere.

Chapter 5 is worth reading for statements and Boolean values, only section 5.12 has a turtle example with Bar Charts with a few exercises.

Chapter 10 starts getting game'esk, with examples that allow you to use keyboard and mouse input to control the turtle NPC, change its color, etc. You can use the previously mentioned "turtle.pos()" to help here, and add string values to determine its color when you change it. It also covers event handling and state machines, though handling mouse input might be a bit trickier. It may be worth playing around with the keyboard examples, though the state machine examples do a lot of screen rendering geometry that might be a turn off.

Chapter 17 is a straight introduction to pygame with an emphasis on graphics, simple drawing of images, fonts and text that are likely not accessible. It then moves on to cover more mid level concepts like animation, drawing checkerboards, sprites, mouse and keyboard events, etc. The first half of the chapter could be a bit useful for a basic setup, but otherwise you could probably skip the rest, I have other pygame examples that focus more on audio and key input available.

Chapter 18, section 18.1 starts off with drawing fractals with turtle, which are cool symetrical graphical shapes based on mathematical algorithms. But then in section 18.2 onward it moves on to covering recursion. Section 18.6 moves back to fractals using pygame. If you don't want to deal with all the graphical fractal stuff, just skip to the Recursion sections and exercises.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2019-05-12 17:43:03 (edited by DaddySpice 2019-05-12 17:43:36)

thanks a lot for the  explanation of the chapters. that actually helps me to understand everything a bit more.

2019-05-12 20:08:11

@9 can we get files with those examples?

2019-05-13 02:31:33

Hell yeah! another blindie using python!

2019-05-13 02:33:54

Graphical stuff, can, hints, can, be useful depending if you want a sighted person to be able to play the game simulairily to how they would in a mainstream game, just with headphones being required.
Most blind programmers don't find graphical stuff useful, but depending if you weant sighted people to actually want to play your game, they can be useful
Granted, the books may talk about them in such a way that you need sight to understand them, I'm not sure because i never read it.

2019-05-13 03:10:19 (edited by magurp244 2019-05-13 06:33:52)

There are other uses for graphics programming other than for visual displays, it being just one of a number of ways of conveying spacial information. For example, AudiMesh3D displays 3D models as sound, to do this it loads a 3D model and draws it visually to the frame buffer, then it extracts the depth buffer image and reprocesses it into sound, or braille output if preferred. All graphics on a computer consist of geometry and math, arrays of data and information, just like a 2D grid for maps, the only difference is in how that information is conveyed to the user, or how its used for your particular application.

@11
Which examples do you mean exactly? If you mean the pygame audio example, you can check that out here:

import pygame
from pygame import mixer
import sys

def Example():
#initialize pygame
    pygame.init()
#initialize sound mixer
    mixer.init()
#create display
    window = pygame.display.set_mode([640,480])
#load sound
    sound = mixer.Sound('tone5.wav')

#main update loop
    while True:
        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN:
            #if space is pressed, play sound
                if event.key == pygame.K_SPACE:
                    sound.play()
            #if escape is pressed, quit
                if event.key == pygame.K_ESCAPE:
                    pygame.quit()
                    sys.exit(0)

    #update window
        pygame.display.update()

Example()

I've also mentioned my OpenAL examples elsewhere which you can get [here] for advanced audio, I can also provide an example with pygame using OpenAL.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2019-05-13 20:26:03

See, my problem comes in with testing.
Suppose I wanted to write a basic application in pygame that just shows the text on the screen that reads "Hello World!". I can follow a tutorial that I found online, but I can't really see the text as it pops up.
This isn't an issue if the text works, but say there is a semantic error? Say I forgot to add in a constant drawing function, so the text flashes onto the screen and promptly screws off. I won't know that until a sighted person goes and tells me "Uh dude, we have a problem."
That's the big personal issue for me. I want the ability to test and see my results and I hate gambling and saying "Well, I hope this works!" With graphics I just have no way of testing, at least not to my knowledge.

2019-05-13 20:47:09 (edited by sito 2019-05-13 20:47:54)

yeah. I completely agree. And at least for me as a blind person I feel that I have a harder time to visualise graphical stuff, it's hard to know what something looks like when you're going to design something. Sure we can follow tutorials but I could learn the syntax of something but when i don't know what it looks like or can't in any way see the results I won't bother learning it. It's the same with web designing. So if i'm going to code something graphical i rather find a design that works on most things and go from there. Also when you work for a company there are usually other people that can do the graphical parts

2019-05-14 03:13:04

Those are fair points. Some of the questions in the book ask to draw specific shapes, which is difficult to compare with the data you get from turtle to make sure your getting the right answer. I'd consider that another subtle bias of the book written for a specific kind of user which can make it difficult to work with by not supplying necessary information. This leads to the case of drawing a GUI purely with code, its true it can be difficult to tell if there are any mistakes without anything to make comparisons too, or if the layout and asthetics are suitable. The latter can be improved with experience and studying existing layout examples, which is a fairly common thing to do.

For the former, as mentioned AudiMesh3D draws things visually, then scrapes that from the frame buffer and reinterprets those images as sound using a built in sonifier, it could be possible to use similar sonifiers like The vOICe for interpreting visual output for GUI troubleshooting. So in the case of drawing "Hello World!" to the screen with pygame, you could use The vOICe in Active Window Client mode and draw the text as white on a black background, and the resulting sonifier output would tell you if the text is displaying or not and where on the screen it is, spelling not withstanding. You could also potentially use it to more methodically test out and put together a GUI layout or interface.

Of course, whether people feel this is worth all the hassle is a totally different question...

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2019-05-14 13:43:28 (edited by sito 2019-05-14 13:44:20)

so. In the end is it worth a a blind person to learn these graphical stuff in combination with the geomithry in the book? I mean as a blind person will you have any use of it in the real world when you're working for a company?
This is what ilike with coding. If you're not good at something there are always libraries and code done by others that you can use and you don't have to put as much work in to it. You just have to understand the consepts in order to adapt and make your code work. And geomithry I think is abit hard for   many blind people to grasp and fully use.

2019-05-14 23:17:49

alright. So after reading this book and discovering just how much they like to use cirkles and triangles i realised that i'm just wasting time here. this in combination with the graphics makes me not want to continue reading this book. Is there another book which uses the same way of explaining thigns as this one does but without using graphics or cirkles, triangles etc in every chapter?
I know some of you might say that it's important to understand these things and i completely agree but I don't want to work with geomithry all the time. Sorry if I come off as neggative that's not my intention at all.
I'll just learn from the python documentation and make my own exercises along the way i think.

2019-05-15 06:32:41

Geometry does have its uses, with or without graphics, but going so far as to learn graphical programming at this point may not hold much value for you, and should be considered more optional. Its perfectly fine if you don't feel the book works for you, what matters is what your comfortable with. You could also check out the other book I mentioned, the Python Practice Book, which doesn't seem to have much of any graphical material. Ultimately its up to you, but if you have any other questions feel free to ask.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2019-05-16 20:48:09

See, I think it's neat to know graphic programming. I think it's neat, but I won't spend ages on creating something I need to use in order to debug what I'm making, primarily because there will be somebody else that can handle that if I ever work with that kind of stuff, and I currently do not have a use for it.
As for How To Think Like A Computer Scientist, that was my starting point, honestly. I couldn't do the Turtle and graphics, but the book layed down the basics of variables, functions, and loops for me. Classes and pygame were learned somewhere else though.
The biggest problem with any tutorial is the lack of application of the concepts you just learned. Case and point, my dumb rotational cipher (I can't think of the name right now). That tested my knowledge of loops and functions. Then came factoring which tested those concepts in addition to if statements and user input, then came various dice games to test the import of modules and libs, and so on.
Trouble is, there's no tutorial that I've found that did that, suggest projects that you can try and do while learning the syntax. I think that's the problem with the BGT tutorial and the people using it to learn these days... you just don't know what you can and can't make. Same for any other language.
While you can argue that BGT has programming in practice sections, let's be real. Those can be simplified even further (Guess the number anyone?) My argument still stands that there should be a project that a person can do after learning variables, user input, and the print statement. I remember feeling like I'm not learning anything when I first started learning coding in general. I still can't say I know anything (I don't), but I know more now than I did 3 months ago.