Re: [pygame] Code: Center of Triangle
DR0ID wrote: Hi def CalculateDistance(a, b): x, y, z = b[0] - a[0], b[1] - a[1], b[2] - a[2] dist = x*x + y*y + z*z return dist * dist no offense, but "x*x + y*y + z*z" is already the distance squared, so no need for "return dist*dist". (or did you do this on purpose?). ~DR0ID Uh, yeah, good catch. :-)
Re: [pygame] Code: Center of Triangle
Patrick Mullen wrote: Yeah, shouldn't it be math.sqrt(dist)? Although you might want to just return the distance^2 so the user can decide whether a sqrt is necessary or not. Yes -- often you don't need the sqrt, e.g. if you just want to compare two distances. Either way, the value you're calling 'dist' should really be called 'distsq' or something. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiem! | Christchurch, New Zealand | (I'm not a morning person.) | [EMAIL PROTECTED] +--+
Re: [pygame] Code: Center of Triangle
Yeah, shouldn't it be math.sqrt(dist)? Although you might want to just return the distance^2 so the user can decide whether a sqrt is necessary or not.
Re: [pygame] Code: Center of Triangle
Hi > > def CalculateDistance(a, b): > x, y, z = b[0] - a[0], b[1] - a[1], b[2] - a[2] > dist = x*x + y*y + z*z > return dist * dist > no offense, but "x*x + y*y + z*z" is already the distance squared, so no need for "return dist*dist". (or did you do this on purpose?). ~DR0ID
Re: [pygame] Tutorial... GUI
Marcus "This makes both types unusable for the description of graphical elements" I am a little confused, did you already have it set up for ATK/AT-SPI? Or it works with them, but not yet for windows? I can read one button that is labeled. The graphic symbols used for buttons either are standard icons which have numbers, or the screen reader just makes a copy of the image and numbers it. So when passing over the button it will cross-reference it and give it the name it has for that graphic symbol. But still does not explain why when having 2 buttons on the same line it sees one, but not the other. Yet at the end it sees the 3 min, max, and close symbols. Now, the title bar and all of the stuff are on the same line, including the 2 buttons, which is not right; button, title, min, max, close. Bruce I should have been more specific on that: The only screen readers I know for Windows use the MSAA system to provide information about the controls of a program. The same applies to the currently available ones for Linux/Unix (Orca and Gnopernicus). Those rely on ATK/AT-SPI accessibility system. This makes both types unusable for the description of graphical elements (in case those do not expose one of those interfaces, MSAA or ATK/AT-SPI). Regards Marcus
Re: [pygame] Tutorial... GUI
Hi James, My reader is Windoweyes. I do have one for earlier versions of windows which is written by JAWS. My version is for XP users. This version will run on any previous version of windows, but not SP2 and later. I would have to pay over $400 to get that upgrade. The cost for new is about $750 now for the latest version of Windows, including Vista... Company: gwmicro.com http://www.gwmicro.com Bruce - Original Message - From: "James Paige" <[EMAIL PROTECTED]> To: Anybody can run a screen reader on their computer. I would be curious to know what specific screen reader software that RR4CLB is using, and whether or not it is available for free, or if it is something you have to pay for. --- James Paige
Re: [pygame] Tutorial... GUI
On, Thu Sep 27, 2007, James Paige wrote: > On Thu, Sep 27, 2007 at 09:19:28PM +0200, Marcus von Appen wrote: > > On, Thu Sep 27, 2007, RR4CLB wrote: > > > > > Hi Marcus, > > > > > > I had my son come over to read the screen and when moving the > > > mouse over the icon it did change color from red to white, but my > > > screen reader mouse control was reading the other screen yet moving > > > over that location. I also noticed that when trying to focus it kept > > > saying to me "Top Menu!" For some odd reason it was not tracking the > > > mouse movement at all, my screen reader was not. > > > > Hm, why does it say "Top Menu!"? I am not familiar with screen readers > > that much - can you assign them to treat different areas of a window in > > different ways? > > > > Anybody can run a screen reader on their computer. I would be curious to > know what specific screen reader software that RR4CLB is using, and > whether or not it is available for free, or if it is something you have > to pay for. I should have been more specific on that: The only screen readers I know for Windows use the MSAA system to provide information about the controls of a program. The same applies to the currently available ones for Linux/Unix (Orca and Gnopernicus). Those rely on ATK/AT-SPI accessibility system. This makes both types unusable for the description of graphical elements (in case those do not expose one of those interfaces, MSAA or ATK/AT-SPI). Regards Marcus pgpdspcNE0M60.pgp Description: PGP signature
Re: [pygame] Tutorial... GUI
On, Thu Sep 27, 2007, RR4CLB wrote: > > > Marcus, > > The menu comment is when I left click on it. They may be because > the button does nothing. > > I read the documentation for programming a screen. It monitors > light-bars, any change in colors. If a part of a screen changes it can > read that area by setting a window for only that area. Either by text > or color. So even the print statements if sent to only one location > and I set a window to read just that area it would say what is > there. Like the print statement you use, have it go to just a single > location. But that is OK for this kind of test but can be a problem if > normal Window conventions are not used; I.E. MSAA configuration. Is there any online documentation or something like that regarding that type of screen reader? It's somewhat difficult to understand for me. I try to sum up what I understood so far: * The screen reader tracks screen changes for certain windows * On color changes it informs you and you can let it give you further details about that area. * Then it tries to read the textual information from that area in some way and provides them using speech sythesis or a braille line Is that correct? > > I still had it read only one button name when labeling the > button. I think that is because the icon is the same. But I did > not have success in doing the same line button. Instead of having > down 40 I placed it across 40 to see if I could see another > graphic symbol there and could not. Unless the other print > statement over-wrote it. But that does not make sense. If I get this right, it means that the reader distinguishes different elements by using some way of image recognition. If they do not differ by at least XY percent, they are recognized as "still the same element, no need to notify the user"? > > I am not sure what is going on, but will have to get my son to > read the new version and see what happens. Windows does want > standard image size and if to small may not read it. O r to large > may not read it. But something else seems to be going on here and > if the mouse position values are not being sent back that could be > the problem, but that to makes no sense. I'm not sure at which point Windows tries to intercept the mouse messages, but possibly the SDL hooks them up in a way, that Windows does not see any need to deal with them later on. > It just reads everything on one line with one graphic symbol at > the beginning and 3 on the other side. Min, max, close > The symbol on the left are the 2 buttons, or at least one of the > 2, the first one displayed. Once more for a better understanding: the reader splits the screen or window into certain areas, which are read one after each other and tries to determine what is displayed on them? > > Now, the 3 on the right seem to be no problem. The screen readers > reads them, I am allowed to label each of them, and reads them > everytime I go to that window, including the one graphic for our > test buttons. But it just does not go to the second one, the > screen reader doesn't. I will test it again with my son here. What does that mean exactly? The screen reader describes what is displayed and you can make up some label for that area, so you can access it easier later on (by referring to the label name)? Regards Marcus pgp8r8b3XJueQ.pgp Description: PGP signature
Re: [pygame] Tutorial... GUI
On Thu, Sep 27, 2007 at 09:19:28PM +0200, Marcus von Appen wrote: > On, Thu Sep 27, 2007, RR4CLB wrote: > > > Hi Marcus, > > > > I had my son come over to read the screen and when moving the > > mouse over the icon it did change color from red to white, but my > > screen reader mouse control was reading the other screen yet moving > > over that location. I also noticed that when trying to focus it kept > > saying to me "Top Menu!" For some odd reason it was not tracking the > > mouse movement at all, my screen reader was not. > > Hm, why does it say "Top Menu!"? I am not familiar with screen readers > that much - can you assign them to treat different areas of a window in > different ways? > Anybody can run a screen reader on their computer. I would be curious to know what specific screen reader software that RR4CLB is using, and whether or not it is available for free, or if it is something you have to pay for. --- James Paige
Re: [pygame] Tutorial... GUI
Marcus, The menu comment is when I left click on it. They may be because the button does nothing. I read the documentation for programming a screen. It monitors light-bars, any change in colors. If a part of a screen changes it can read that area by setting a window for only that area. Either by text or color. So even the print statements if sent to only one location and I set a window to read just that area it would say what is there. Like the print statement you use, have it go to just a single location. But that is OK for this kind of test but can be a problem if normal Window conventions are not used; I.E. MSAA configuration. I still had it read only one button name when labeling the button. I think that is because the icon is the same. But I did not have success in doing the same line button. Instead of having down 40 I placed it across 40 to see if I could see another graphic symbol there and could not. Unless the other print statement over-wrote it. But that does not make sense. I am not sure what is going on, but will have to get my son to read the new version and see what happens. Windows does want standard image size and if to small may not read it. O r to large may not read it. But something else seems to be going on here and if the mouse position values are not being sent back that could be the problem, but that to makes no sense. It just reads everything on one line with one graphic symbol at the beginning and 3 on the other side. Min, max, close The symbol on the left are the 2 buttons, or at least one of the 2, the first one displayed. Now, the 3 on the right seem to be no problem. The screen readers reads them, I am allowed to label each of them, and reads them everytime I go to that window, including the one graphic for our test buttons. But it just does not go to the second one, the screen reader doesn't. I will test it again with my son here. Bruce If you have an example that causes your screen reader to act differently, could you please send it to me (same mail address as the one I am using for those list posts)? This will help me to understand the screen reader system somewhat better and maybe how to come up with a workaround until we can use a MSAA enabled backend to provide the information as necessary. Regards Marcus On, Thu Sep 27, 2007, RR4CLB wrote: > Hi Marcus, > > I had my son come over to read the screen and when moving the > mouse over the icon it did change color from red to white, but my > screen reader mouse control was reading the other screen yet moving > over that location. I also noticed that when trying to focus it kept > saying to me "Top Menu!" For some odd reason it was not tracking the > mouse movement at all, my screen reader was not. Hm, why does it say "Top Menu!"? I am not familiar with screen readers that much - can you assign them to treat different areas of a window in different ways?
Re: [pygame] noname
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ian Mallett wrote: > On many people's posts, they seem to be attaching a small file called > "noname". It reads as follows: > > I'm not sure why this is, though I'm guessing your email browser does > it for some reason. I'm using gmail, and it appears as an attachment. > Why? Hi, I'm probably one of the people whose messages show up like this. This is a PGP signature. Its use is to ensure through cryptography that I'm the person who sent this email with this text on the date claimed. Since all email is sent in plaintext with pretty much no security whatsoever, any email can be snooped or forged. The signature is a method (you might say "kludge") by which the authenticity of an email can be verified, much like a handwritten signature is on an ordinary letter. A PGP signature is not much use without 1) my public key, which is on my site, verified in some way, and 2) software to verify the signature. A good email client will provide this software integrated into the program in some way -- Thunderbird has a plugin called Enigmail, Sylpheed has a plugin called PGPMIME, mutt has some options like this, etc. On email clients that don't support cryptography, which is unfortunately the majority[1], you end up seeing blocks of text like the one you included in your email. You could, theoretically, download the message and run a PGP program on the text and the signature, but this is too much work for most people. [1] Note that GMail is not unique among webmail providers that do not support cryptography. In order for a webmail provider to properly support PGP signatures, it would have to authenticate to the user, for example using HTTP certificates. Otherwise the HTTP transmission could theoretically be intercepted and a fake "Signature verified" message added. Of course, for maximum security you'd also need to see the source code running on the webmail server. Explaining how it works is probably outside of the scope of this mailing list :) but you can see Wikipedia's article on public-key cryptography to get an idea: http://en.wikipedia.org/wiki/Public-key_cryptography Ethan -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG/AnIhRlgoLPrRPwRAtx6AJ9YDMDsEkIJOmJcTymCIsF7gECxpQCgnTZi gcAzidIPE/j08RxsG1nhWUo= =+SI5 -END PGP SIGNATURE-
GnuPG signatures (was: Re: [pygame] noname)
On, Thu Sep 27, 2007, Lamonte Harris wrote: > Probably there using weird signatures or something. No, it is a so called PGP (or in that case GnuGP) signature, which lets you verify, that a) the mail comes from the originator and b) was not modified on its way to you. See http://www.gnupg.org/ and http://en.wikipedia.org/wiki/GNU_Privacy_Guard for more information about the free implementation. Regards Marcus pgppvGsA0ZugD.pgp Description: PGP signature
Re: [pygame] noname
Probably there using weird signatures or something. On 9/27/07, Ian Mallett <[EMAIL PROTECTED]> wrote: > > On many people's posts, they seem to be attaching a small file called > "noname". It reads as follows: > > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.4.7 (FreeBSD) > > iD8DBQFG/AJAo/JpszXavhwRAg3EAJ9PZJCU4LMFQyx0y0V5c92hBrPP/QCfdU7c > vqzcEK8siubKBKFGaMdfKIc= > =Fti0 > -END PGP SIGNATURE- > > I'm not sure why this is, though I'm guessing your email browser does > it for some reason. I'm using gmail, and it appears as an attachment. > Why? > > Ian >
[pygame] noname
On many people's posts, they seem to be attaching a small file called "noname". It reads as follows: -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFG/AJAo/JpszXavhwRAg3EAJ9PZJCU4LMFQyx0y0V5c92hBrPP/QCfdU7c vqzcEK8siubKBKFGaMdfKIc= =Fti0 -END PGP SIGNATURE- I'm not sure why this is, though I'm guessing your email browser does it for some reason. I'm using gmail, and it appears as an attachment. Why? Ian
Re: [pygame] Tutorial... GUI
On, Thu Sep 27, 2007, RR4CLB wrote: > Hi Marcus, > > I had my son come over to read the screen and when moving the > mouse over the icon it did change color from red to white, but my > screen reader mouse control was reading the other screen yet moving > over that location. I also noticed that when trying to focus it kept > saying to me "Top Menu!" For some odd reason it was not tracking the > mouse movement at all, my screen reader was not. Hm, why does it say "Top Menu!"? I am not familiar with screen readers that much - can you assign them to treat different areas of a window in different ways? > > I will place both buttons next to each other on the same line and > see what happens. For I am going to rule out the sizing of the > screen for it may think it is only a one line screen. Once I rule > that out I will have to wait until you change it. I do get it > reading the icon I labeled. I just have to get the screen reader > to also focus on the second button. First by placing them both on > the same line and see if that fixes it. Then if so, doing a frame > size save and make it a custom window and go from there. If I can > get that part done and get the mouse to at least read it, I am > half way there. Allowing me to build and test the programs, But > not to distribute it for others to play. If you have an example that causes your screen reader to act differently, could you please send it to me (same mail address as the one I am using for those list posts)? This will help me to understand the screen reader system somewhat better and maybe how to come up with a workaround until we can use a MSAA enabled backend to provide the information as necessary. Regards Marcus pgpBJEUlYeA7F.pgp Description: PGP signature
[pygame] Code: Center of Triangle
Worked this up today for myself, thought I'd post it in case someone else found it useful. import pygame def CenterOfTriangle(A, B, C): return (A[0] + B[0] + C[0])/3.0, (A[1] + B[1] + C[1])/3.0, (A[2] + B[2] + C[2])/3.0 def CalculateDistance(a, b): x, y, z = b[0] - a[0], b[1] - a[1], b[2] - a[2] dist = x*x + y*y + z*z return dist * dist def NearestVert(triangle, pos): distance = v = -1 for i in range(len(triangle)): temp = CalculateDistance(triangle[i], [pos[0], pos[1], 0]) if temp < distance: distance = temp v = i assert(v >= 0) return v def main(): pygame.init() screen = pygame.display.set_mode([640, 480], 0, 32) quit = 0 triangle = [[132, 319, 0], [282, 120, 0], [434, 319, 0]] center = CenterOfTriangle(*triangle) v = -1 font = pygame.font.Font(None, 18) pic = font.render('Center: %d, %d, %d Triangle: %s' % (int(center[0]), int(center[1]), int(center[2]), triangle), 1, (0, 0, 0)) while not quit: screen.fill((255, 255, 255)) pygame.draw.polygon(screen, (0, 0, 0), [triangle[0][:2], triangle[1][:2], triangle[2][:2]], 1) x, y, z = int(center[0]), int(center[1]), int(center[2]) screen.fill((255, 0, 0), [x-2, y-2, 4, 4]) screen.blit(pic, [0, 450]) pygame.display.flip() pygame.event.pump() for e in pygame.event.get(): if e.type == pygame.QUIT: quit = 1 break elif e.type == pygame.MOUSEBUTTONDOWN: v = NearestVert(triangle, e.pos) elif e.type == pygame.MOUSEMOTION: if v > -1: triangle[v] = [e.pos[0], e.pos[1], 0] center = CenterOfTriangle(*triangle) pic = font.render('Center: %d, %d, %d Triangle: %s' % (int(center[0]), int(center[1]), int(center[2]), triangle), 1, (0, 0, 0)) elif e.type == pygame.MOUSEBUTTONUP: v = -1 pygame.quit() main()
Re: [pygame] Tutorial... GUI
Hi Marcus, I had my son come over to read the screen and when moving the mouse over the icon it did change color from red to white, but my screen reader mouse control was reading the other screen yet moving over that location. I also noticed that when trying to focus it kept saying to me "Top Menu!" For some odd reason it was not tracking the mouse movement at all, my screen reader was not. I will place both buttons next to each other on the same line and see what happens. For I am going to rule out the sizing of the screen for it may think it is only a one line screen. Once I rule that out I will have to wait until you change it. I do get it reading the icon I labeled. I just have to get the screen reader to also focus on the second button. First by placing them both on the same line and see if that fixes it. Then if so, doing a frame size save and make it a custom window and go from there. If I can get that part done and get the mouse to at least read it, I am half way there. Allowing me to build and test the programs, But not to distribute it for others to play. Bruce On, Thu Sep 27, 2007, RR4CLB wrote: > > So I guess that both the buttons and text have to be in the same > frame. The only thing to do is look up the format of a button > inside the win32 and see what they did to accomplish that. I > believe those are ADA, 504 kind of things for standards, > accessibility issues. Having both, the text output and the accessibility aware pygame user interface element in the same frame sounds impossible to me. As you mentioned in you other mail the only way seems to be to wrap up the MSAA framework with python in order to spend the game objects an accessibility interface a screen reader can recognize. As I planned to do that by time for the python accessibility wrapper anyways, I'll check, if that's possible in some easy way, so you can make your game objects accessibility aware. Regards Marcus
Re: [pygame] Tutorial... GUI
Marcus, The issue is still there for at least text labeling. The cursor tabbing does not say anything because there is nothing there for it to scan and that may be because of no MSAA support. The text labeler for the mouse and icons still works but for only one button. I am going to have to try something on this issue, but first change the location of the second button and see what happens there. The mouse when going over the button does change color, red > white, but my screen reader is not reading the same location... Bruce
Re: [pygame] Tutorial... GUI
Marcus, Still the same issue. I think the problem when labeling the button is not so much the color, but the image. For when labeling the button it is copying that image and saving a text label along with a copy of that image. Each image has a number value and probably that is what is being saved. So, I am not sure if buttons are all the same or can there images be changed by choice. Probably the only way to fix the problem, besides MSAA issues. At least the mouse sees the saved image and gives a text label for it when the mouse goes over the button. I am going to try 2 other things and get back with you. Thanks, Bruce Bruce On, Thu Sep 27, 2007, RR4CLB wrote: > > I noticed just only one graphic symbol present. I labeled it and > the ladle stayed the same for both, that means they are the same > color/image. So when tabbing back and forth the first screen said > button 1 or button 2 but the screen reader only read the same > label. Also when tabbing I got no text, which means no text label > in the button itself. Which label did the screen reader read? Does it receive the button information or only the title text of the pygame window? I think, the screen reader cannot receive any information from the AT software, because pygame (and SDL in general) simply does not support such accessibility features. However, I attached a slightly modified version of the button example, in which the first button now receives a red background colour, the second one a green background colour. If you could give it a try, it'd be helpful for me to figure out on what I have to focus for the accessibility systems. > > So, I guess there has to be a different color or image I would > have to use for each button. Also, text label for the button, is > that in this or forced to be in first screen window? For when it > said which was focused I had to go to the other screen by alt > tab. Control tab went back to the first button but the text label > I placed on it with the screen reader still read Button 2, because > of button color/image. The visual representation of the buttons displays a textual label on them as done in the code. I simply added a print function (which goes to the other console window) for the focus so you can distinguish between both buttons in case the screen reader cannot deal with them correctly. I hope, the screen reader can recognize the changed example correctly now. If not, we have to think of another solution as it is likely that the screen reader won't be able to deal with any content displayed on the pygame window then. This would mean that each object to be shown needs accessibility awareness through the MSAA library (or ATK/AT-SPI for unix). Regards Marcus
Re: [pygame] Tutorial... GUI
On, Thu Sep 27, 2007, RR4CLB wrote: > > So I guess that both the buttons and text have to be in the same > frame. The only thing to do is look up the format of a button > inside the win32 and see what they did to accomplish that. I > believe those are ADA, 504 kind of things for standards, > accessibility issues. Having both, the text output and the accessibility aware pygame user interface element in the same frame sounds impossible to me. As you mentioned in you other mail the only way seems to be to wrap up the MSAA framework with python in order to spend the game objects an accessibility interface a screen reader can recognize. As I planned to do that by time for the python accessibility wrapper anyways, I'll check, if that's possible in some easy way, so you can make your game objects accessibility aware. Regards Marcus pgpbCLZoz7HAr.pgp Description: PGP signature
Re: [pygame] Tutorial... GUI
Marcus, "needs accessibility awareness through the MSAA library (or ATK/AT-SPI" I think that the MSAA library is exactly what we are talking about. I have not tried the new one yet, but I suspect that this is the issue. I can try and teach the screen reader to read a screen that is produced all the time and that may also work. But one step at a time is what I have to do in order to learn this. But the MSAA library is probably the issue. For all Window Eyes stuff is to focus on it. Even has a special key to get into and out of that mode. So on to testing and I will get back with you. Thanks, Bruce On, Thu Sep 27, 2007, RR4CLB wrote: > > I noticed just only one graphic symbol present. I labeled it and > the ladle stayed the same for both, that means they are the same > color/image. So when tabbing back and forth the first screen said > button 1 or button 2 but the screen reader only read the same > label. Also when tabbing I got no text, which means no text label > in the button itself. Which label did the screen reader read? Does it receive the button information or only the title text of the pygame window? I think, the screen reader cannot receive any information from the AT software, because pygame (and SDL in general) simply does not support such accessibility features. However, I attached a slightly modified version of the button example, in which the first button now receives a red background colour, the second one a green background colour. If you could give it a try, it'd be helpful for me to figure out on what I have to focus for the accessibility systems. > > So, I guess there has to be a different color or image I would > have to use for each button. Also, text label for the button, is > that in this or forced to be in first screen window? For when it > said which was focused I had to go to the other screen by alt > tab. Control tab went back to the first button but the text label > I placed on it with the screen reader still read Button 2, because > of button color/image. The visual representation of the buttons displays a textual label on them as done in the code. I simply added a print function (which goes to the other console window) for the focus so you can distinguish between both buttons in case the screen reader cannot deal with them correctly. I hope, the screen reader can recognize the changed example correctly now. If not, we have to think of another solution as it is likely that the screen reader won't be able to deal with any content displayed on the pygame window then. This would mean that each object to be shown needs accessibility awareness through the MSAA library (or ATK/AT-SPI for unix). Regards Marcus
Re: [pygame] Tutorial... GUI
Marcus, It is like what all links/images especially have and that is an alt field. It is a text field setup on web pages to also have text in a picture to describe the picture for sightless people and screen readers. So when the tab goes to that button or link it is also entering a text field, not an edit field, but a text field. Now, I am not sure if colors are important for that, that is what I am talking about. It is just like the alt field of picture/images on an HTML page. What happened when tabbing from button to button the display on the other screen did change, but the screen reader focus was not on that frame. In other words the text was in another frame... When focusing inside a frame I have to force the mouse to be there. Now when tabbing or cursor keys, the screen reader will be in that frame sometimes. To get it to work I also had to focus that as well. But those things can be over-come when the parameters of the window are known and saved. All that is a screen reader thing. So I guess that both the buttons and text have to be in the same frame. The only thing to do is look up the format of a button inside the win32 and see what they did to accomplish that. I believe those are ADA, 504 kind of things for standards, accessibility issues. I hope you understand what I am trying to say. Bruce On, Thu Sep 27, 2007, RR4CLB wrote: > But the tab went from button to button but the display of the text > for that button was on another screen. There should be a text > label for buttons so when I tab it also says its text label. I am > not sure the example I had was written that way. It just assigned > text to the object. I am not entirely sure what you mean with "says" here. Do you want a sound mixer to output the text of the button, when it receives tab focus? Regards Marcus
Re: [pygame] video error
Is the entirety of your code in your __init__ class? I'm not sure if the spacing got mangled in the e-mail but the way it came across when I cut and pasted the class into my editor is that your while loop is in the main Class, not in the __init__ function. Since the class gets created before the __init__ is called that's what's causing your problem. On 9/26/07, Eric Hunter <[EMAIL PROTECTED]> wrote: > > can't understand why I'm getting this error. everything looks okay to me. > but then again I'm a newbie. thanks in advance. > > Traceback (most recent call last): > File "las.py", line 54, in > class PygameClass(): > File "las.py", line 78, in PygameClass > for event in pygame.event.get(): > pygame.error: video system not initialized > > > > [code] > class PygameClass(): > # Starts Pygame > def __init__(self, full_path): > pygame.init() > self.window = pygame.display.set_mode((1,1), pygame.RESIZABLE) > > self.image_name = os.path.basename(full_path) > pygame.display.set_caption(self.image_name) > self.image = pygame.image.load(full_path) > self.image = self.image.convert() > self.image_rect = self.image.get_rect() > print self.image_rect > print self.image_rect.width > print self.image_rect.height > self.window = pygame.display.set_mode((self.image_rect.width, > self.image_rect.height)) > self.window = self.window.convert() > > self.point_draw = 1 > self.numRect = 0 > rect = {} > > self.screen.blit(self.image, (0, 0)) > pygame.display.flip() > > while True: > for event in pygame.event.get(): > if self.event.type == QUIT: > pygame.quit() > sys.exit() > > elif self.event.type == pygame.KEYDOWN: > if self.event.key == K_s: > self.out_file = open("text.txt", "w") > pickle.dump(rect, self.out_file) > print "memory dumped." > self.out_file.close() > if self.event.key == K_o: > self.in_file = open('text.txt', 'r') > rect = pickle.load(self.in_file ) > print "memory loaded." > self.in_file.close() > > elif self.event.type == pygame.MOUSEBUTTONDOWN: > if self.event.button == 1: > # If point_draw = 1, get x,y of mouse > if self.point_draw == 1: > self.mouseX1, self.mouseY1 = pygame.mouse.get_pos > () > self.point_draw = 2 > else: > # If point_draw = 2, get x,y of mouse, make a rect > and throw it in a dictionary > self.mouseX2, self.mouseY2 = pygame.mouse.get_pos > () > self.numRect += 1 > self.newRect = pygame.Rect(self.mouseX1, > self.mouseY1, self.mouseX2 - self.mouseX1, self.mouseY2 - self.mouseY1) > rect[self.numRect ] = self.newRect > self.point_draw = 1 > elif self.event.button == 3: > self.mouseXTEMP, self.mouseYTEMP = > pygame.mouse.get_pos() > for self.x in rect.keys(): > if rect[self.x].collidepoint(self.mouseXTEMP, > mself.ouseYTEMP): > del rect[x] > self.numRect -= 1 > > # draws the rectangles in the rect{} > for self.x in rect.keys(): > pygame.draw.rect(window, ((255, 255, 0)), rect[self.x], 1) > > pygame.display.flip() > > [/code] >
Re: [pygame] Tutorial... GUI
On, Thu Sep 27, 2007, RR4CLB wrote: > > I noticed just only one graphic symbol present. I labeled it and > the ladle stayed the same for both, that means they are the same > color/image. So when tabbing back and forth the first screen said > button 1 or button 2 but the screen reader only read the same > label. Also when tabbing I got no text, which means no text label > in the button itself. Which label did the screen reader read? Does it receive the button information or only the title text of the pygame window? I think, the screen reader cannot receive any information from the AT software, because pygame (and SDL in general) simply does not support such accessibility features. However, I attached a slightly modified version of the button example, in which the first button now receives a red background colour, the second one a green background colour. If you could give it a try, it'd be helpful for me to figure out on what I have to focus for the accessibility systems. > > So, I guess there has to be a different color or image I would > have to use for each button. Also, text label for the button, is > that in this or forced to be in first screen window? For when it > said which was focused I had to go to the other screen by alt > tab. Control tab went back to the first button but the text label > I placed on it with the screen reader still read Button 2, because > of button color/image. The visual representation of the buttons displays a textual label on them as done in the code. I simply added a print function (which goes to the other console window) for the focus so you can distinguish between both buttons in case the screen reader cannot deal with them correctly. I hope, the screen reader can recognize the changed example correctly now. If not, we have to think of another solution as it is likely that the screen reader won't be able to deal with any content displayed on the pygame window then. This would mean that each object to be shown needs accessibility awareness through the MSAA library (or ATK/AT-SPI for unix). Regards Marcus # Import the necessary ocempgui parts. from ocempgui.widgets import * from ocempgui.widgets.Constants import * # object_focused will print a widget's text to the console. def object_focused (gui_widget): print "Element %s is focused" % gui_widget.text # Create the first button with no text and place it at screen offset 10, # 10. button_one = Button () button_one.topleft = 10, 10 # Create a red background color for the first button and assign it a red # label with the text "Button number one". label_one = Label ("Button number one") label_one.create_style() label_one.style["bgcolor"][STATE_NORMAL] = (255, 0, 0) button_one.create_style() button_one.style["bgcolor"][STATE_NORMAL] = (255, 0, 0) button_one.child = label_one # Connect the focus event (for tab). button_one.connect_signal (SIG_FOCUSED, object_focused, button_one) # Connect the mouse enter event to the button to have some "hover" # effect. button_one.connect_signal (SIG_ENTER, object_focused, button_one) # Create the second button with no text and place it 40 pixels beneath # the first one. button_two = Button () button_two.topleft = button_one.left, button_one.bottom + 40 # Create a green background color for the second button and assign it a # green label with the text "Button number two". label_two = Label ("Button number two") label_two.create_style() label_two.style["bgcolor"][STATE_NORMAL] = (0, 255, 0) button_two.create_style() button_two.style["bgcolor"][STATE_NORMAL] = (0, 255, 0) button_two.child = label_two # Connect the focus event (for tab or mouse "hover") of the second button. button_two.connect_signal (SIG_FOCUSED, object_focused, button_two) # Connect the mouse movement event to the button to have some "hover" # effect. button_two.connect_signal (SIG_ENTER, object_focused, button_two) # Create the renderer object. re = Renderer () # Let the renderer create a pygame screen with 200 pixels width and 200 # pixels height. re.create_screen (200, 200) # Set the window title to "Two button demo". re.title = "Two button demo" # Set the screen background color to a grey RGB value. re.color = (200, 200, 200) # Add the both buttons. re.add_widget (button_one, button_two) # Start the main loop for drawing and event processing. re.start () pgpso2vio6DXo.pgp Description: PGP signature
Re: [pygame] Tutorial... GUI
On, Thu Sep 27, 2007, RR4CLB wrote: > But the tab went from button to button but the display of the text > for that button was on another screen. There should be a text > label for buttons so when I tab it also says its text label. I am > not sure the example I had was written that way. It just assigned > text to the object. I am not entirely sure what you mean with "says" here. Do you want a sound mixer to output the text of the button, when it receives tab focus? Regards Marcus pgpA2oQwy7Dku.pgp Description: PGP signature