Computer Science Canada buttons |
Author: | hgrad98 [ Sun Oct 27, 2013 11:23 am ] |
Post subject: | buttons |
What is it you are trying to achieve? create buttons What is the problem you are having? don't know how Describe what you have tried to solve this problem internet Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) Please specify what version of Turing you are using 4.1.1 |
Author: | DemonWasp [ Sun Oct 27, 2013 11:37 am ] |
Post subject: | RE:buttons |
The Turing Walkthrough ( http://compsci.ca/v3/viewtopic.php?t=8808 ) is a great place to start. Especially the link to a tutorial on using the GUI module to create buttons. |
Author: | hgrad98 [ Sun Oct 27, 2013 1:29 pm ] | ||
Post subject: | RE:buttons | ||
nothing is working!!! omg im going insane sitting here searching the internet on how to do this!!!!! the code from the walkthrough isnt working for me!!! my code:
i need to have it so that there are buttons that you click to choose the category instead of typing! someone please just show me what to do instead of saying look at this website! "no offense demonwasp but everybody just says look at this website, or this one!!! someone just show me please with code!! thanks |
Author: | DemonWasp [ Sun Oct 27, 2013 1:36 pm ] |
Post subject: | RE:buttons |
Members of compsci.ca will not do homework for you. I noticed that your code never calls GUI.CreateButton ... or anything else from the GUI module. How were you hoping that it would work without even trying anything? Try creating a separate "example" program that has two buttons. If you press the first button, it prints "A", and if you press the second button, it prints "B". Use the "GUI" examples in the Turing Walkthrough. Once you've got that working, you should be able to modify your main program to use what you learned from your example. By the way, half of being a software developer is knowing how to find the right resource (website, book, manual, API documentation, ...) to read and reading that. Very little time is actually spent writing code. |
Author: | hgrad98 [ Sun Oct 27, 2013 1:42 pm ] |
Post subject: | RE:buttons |
all of the homework is done. that whole code was my project. my teacher said if you want a level 3 then you just do multiplication, addition and subtraction. if you want a level 4, then you have to also do division and all four categories together. also showing their score after each game, making it possible to take the test again and again, then showing their total score. AND adding something we DIDN'T learn in class. that's why im asking. because i don't know it. i wasn't taught it. but i have everything done for the level 4 except for something i wasn't taught. so i was just asking for a little bit of help to guide me in the right direction. not a site. thanks. and i looked at the Turing Walkthrough for a while. several times |
Author: | hgrad98 [ Sun Oct 27, 2013 1:44 pm ] |
Post subject: | RE:buttons |
i also know where to look for the help. i have searched all over the place online, and on the turing "reference" part that is part of turing. all of there examples work but when i try to put it into my code, it doesnt work. |
Author: | Insectoid [ Sun Oct 27, 2013 1:48 pm ] |
Post subject: | RE:buttons |
Do you know why or how it works? You can't just copy & paste preexisting code into your projects and expect it to work. You need to how and why it works in order to adapt it to your own code. Did you actually read the article in the Turing Walkthrough or just look at the code? Did you read the reference? |
Author: | hgrad98 [ Sun Oct 27, 2013 1:54 pm ] |
Post subject: | RE:buttons |
i read them about twice each. tried it on my own. with my code: didn't work. then i tried copying it. didnt work either |
Author: | Nathan4102 [ Sun Oct 27, 2013 3:58 pm ] |
Post subject: | RE:buttons |
Post the code you've tried, and we'll try to help you out. |
Author: | hgrad98 [ Sun Oct 27, 2013 6:21 pm ] | ||
Post subject: | RE:buttons | ||
and it doesnt work. i wasn't taught it in class, so it isn't homework. it is adding to my "finished" assignment to get better marks. i want to make a button for each category: Addition, Subtraction, Multiplication, Division, and All (all 4 together) thanks |
Author: | Insectoid [ Sun Oct 27, 2013 6:33 pm ] |
Post subject: | RE:buttons |
Well, for one thing you're missing your associated procedures and closing brackets. Read your error codes. They usually tell you what's wrong. |
Author: | DemonWasp [ Sun Oct 27, 2013 6:40 pm ] | ||
Post subject: | RE:buttons | ||
Since it's for marks in school, it's still in the "we can help, but won't write code for you" category. It looks like you've forgotten to specify a "callback" method for your buttons, and you've forgotten to close the open-brackets. You also forgot the "event processing loop". Here's a minimal example for how to draw two buttons. One puts "Hello world" in the top left, while the other clears the topmost line. Note that you have to specify the procedure to call when the button is clicked when you create the button.
|
Author: | hgrad98 [ Sun Oct 27, 2013 7:05 pm ] |
Post subject: | RE:buttons |
ok i figured out what does what in your code. understand it, opened a new turing. copied pasted. i ran it, it worked. i closed that turing. now i fixed the issues with my code but it still doesnt work. it says that some of my variables aren't imported |
Author: | hgrad98 [ Sun Oct 27, 2013 7:07 pm ] |
Post subject: | RE:buttons |
and that the GUI wasnt imported. even though at the top of my program, i typed import GUI. |
Author: | hgrad98 [ Sun Oct 27, 2013 7:19 pm ] |
Post subject: | RE:buttons |
an error code at procedure Addition says: 'procedure' may only be declared at the program, module, or monitor level. what does that mean? |
Author: | Insectoid [ Sun Oct 27, 2013 7:31 pm ] | ||
Post subject: | RE:buttons | ||
It means you're trying to declare a procedure inside a loop, if statement, or another procedure.
|
Author: | hgrad98 [ Sun Oct 27, 2013 7:41 pm ] |
Post subject: | RE:buttons |
those are the only errors. everything else is fine. can someone please tell me what that error means? |
Author: | hgrad98 [ Sun Oct 27, 2013 7:57 pm ] |
Post subject: | RE:buttons |
ok. so i cant have the whole thing loop, and work with the buttons? |
Author: | hgrad98 [ Sun Oct 27, 2013 7:59 pm ] |
Post subject: | RE:buttons |
it doesnt work without the loops |
Author: | Nathan4102 [ Sun Oct 27, 2013 8:03 pm ] |
Post subject: | RE:buttons |
Don't loop your whole program. Instead, just loop your GUI.ProcessEvent, and anything else you need. |
Author: | hgrad98 [ Sun Oct 27, 2013 8:08 pm ] |
Post subject: | RE:buttons |
but i had to make the program so that the user could run the program over again without having to actually click on "run" on the "editing page" so i used a big loop. and if i take that away (already tried) nothing works. it finishes the program right away |
Author: | hgrad98 [ Sun Oct 27, 2013 8:21 pm ] |
Post subject: | RE:buttons |
it only reruns the type of quiz they just took. it doesn't let them choose a different type. ![]() |
Author: | Raknarg [ Sun Oct 27, 2013 8:27 pm ] |
Post subject: | RE:buttons |
You can loop your loop. |
Author: | hgrad98 [ Sun Oct 27, 2013 8:28 pm ] |
Post subject: | RE:buttons |
Ok ! finally it works!!!!! but the rerun is messed up. |
Author: | hgrad98 [ Sun Oct 27, 2013 8:29 pm ] |
Post subject: | RE:buttons |
and when you select a category, the buttons dont dissapear |
Author: | hgrad98 [ Mon Oct 28, 2013 3:51 pm ] |
Post subject: | RE:buttons |
ok i got them to dissapear after the selection. now i just have to make it so they could retry it. |