-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SMALL BASIC - More methods for further geometric forms ... #192
Comments
You can use VB .NET or C# to create a lib for small basic to do what you want: But, on the other hand, SB shouldn't be used beyond what it is created for, as it should be a step up towards learning VB.NET. And to make this even easier, I created the Small Visual Basic language on top of Small Basic, with more compiler features and a windows forms designer and library. You can crate any shape you want as a Xaml file, and add it to the toolbox folder, so you can drag it on the form and use it as a control, and fill it with any back color you want! |
Hi Mohammad, thanks for your replies. I am a hobby programmer and only use MS BASIC-Dialects like Small Basic, QBasic, QuickBasic, GW-Basic. I also love Scratch and a bit Python, too. So I'm interested in programming in different fields of education and not in professional development. I am not able to use other languages (e.g. C++, C#) to solve my problems in Small Basic. My problem in Small Basic is, for example: I try to program the flags of the world. Sometimes there are special geometric figures like a pentagram (Fünfstern -> USA) or hexagram (Sechsstern -> Israel) or seven-star (Siebenstern -> Australia). With the turtle I can program these figures and fill them out with color while creating further turtles inside. On the other hand I could divide a five-star, six-star and seven-star in triangles. I then have to find an algorithm to create any five- or six- or seven-star in different sizes, colors, borders and locations on the graphics window. That is my current challenge. Maybe you can help me. That would be great. Regards ... Gregor |
@boa2145 |
I included images for special flags (e.g. Argentina), but I want to program colored n-stars, too. How can I install Small Visual Basic? |
It doesn't require installation. Download the zip file from the assets at the bottom of this page: |
Well, Small Visual Basic works. Now I have to find an introduction to program with your app. Do you know a Small Visual Basic tutorial? |
See the readme |
@boa2145 GraphicsWindow.BrushColor = Colors.AliceBlue
GraphicsWindow.PenColor = Colors.Red
GraphicsWindow.PenWidth = 3
GeometricPath.CreateFigure(100, 100)
GeometricPath.AddLineSegment(50, 150, True)
GeometricPath.AddLineSegment(100, 200, True)
GeometricPath.AddLineSegment(200, 200, True)
GeometricPath.AddLineSegment(250, 150, True)
GeometricPath.AddLineSegment(200, 100, True)
GeometricPath.AddLineSegment(100, 100, True)
Sh = Shapes.AddGeometricPath()
Shapes.Rotate(Sh, 45) I will add more |
sVB v2.2 is released: |
Hi Mohammad, thanks for your effort and help. I'll try it next time when I want to program a flag. The first two parameters of the method "AddLineSegement" are the x/y-coordinates, aren't they? Could you explain "GeometricPath.CreateFigure(100, 100)", please? |
@boa2145 Label1.AddGeometricPath(
Colors.Red, ' Pen color
2, ' Pen width
Colors.Yellow ' Brush color
)
Label1.Rotate(45) The advatage of adding shapes to the label, is that you can handle their events. I think it is a valuable addition to sVB. Thanks. |
@boa2145 GraphicsWindow.PenColor = Colors.Black
GraphicsWindow.PenWidth = 3
GraphicsWindow.BrushColor = Colors.Red
X = Shapes.AddPolygon(
{
{0, 100},
{76.5, 100},
{100, 25},
{123.5, 100},
{200, 100},
{140, 142.5},
{160, 200},
{100, 145},
{40, 200},
{62, 142.5}
}
) This will be available in the upcoming sVB 2.4.5 I think SB didn't add the Polygon because it will be verbose to add the points to the array in the traditional way. sVB allows to use array initializer {}, so, as you can see, you can supply any number of points to create any n-polygon you want. |
Hello Mohammad, thanks for your help. Unfortunately I have the problem that I don't have enough instructions to get your code snippets to work. This makes me a little confused as to how to program on your Small Visual Basic IDE. Best regards... Gregory |
@boa2145 |
@boa2145 |
Hello Mohammad,
Thanks a lot for sharing your Small Visual Basic reference book with me.
That is very big and helpful to use your special version of Small Basic. In
the meantime I have realized that the turtle object in Small Basic is not
very numerous and first of all pretty slow. What's the matter with your
turtle object in terms with its speed?
Kind regards ... Gregor
Am So., 14. Mai 2023 um 17:34 Uhr schrieb Mohammad Hamdy Ghanem <
***@***.***>:
… @boa2145 <https://github.com/boa2145>
As promised, sVB full reference book
<https://drive.google.com/file/d/1pCnB4_7pEBc_wT2u258MmutYCuXwpvjN>
[image: 1111]
<https://user-images.githubusercontent.com/48354902/238195685-dd4c2f5e-cc83-4597-bb51-d1f583507243.png>
—
Reply to this email directly, view it on GitHub
<#192 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3D5YMRDE7EJ4VCNBZGTPRLXGD3QPANCNFSM6AAAAAAQO5FJ4M>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@boa2145 |
Hello Mohammad,
yes, Small Basic's turtle obeject has only a few methods. It is slow with
speed = 10, too. Complex geometrical shapes are almost impossible. I also
use the turtle with Python and TigerJython, last one has a big module
called "gturtle", but the module "turtle" by Python is also much better
than Small Basic's one.
Regards ... Gregor 😊
Mohammad Hamdy Ghanem ***@***.***> schrieb am Di., 16. Mai
2023, 09:01:
… @boa2145 <https://github.com/boa2145>
You can increase the turtle speed:
Turtle.Speed = 10
But the turtle will always be relatively slow. It is meant to be fun for
kids, not a very practical drawing tool.
—
Reply to this email directly, view it on GitHub
<#192 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3D5YMTK653PPIRER7VORI3XGMQ5TANCNFSM6AAAAAAQO5FJ4M>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hello Mohammed,
I'll study your sVB reference, but it will take me a while to get there.
Small Visual Basic is probably much more powerful than Small Basic. I've
already seen that sVB also has arguments and parameters using procedures,
which I really miss in Small Basic. As a result, there are local and global
variables in sVB, which makes programming much more interesting and easier.
Is it possible for you to expand the skills of turtle programming at sVB?
If you look at the turtle module called "turtle" for Python, you'll see
that there are many more methods there. This makes it possible to use
"begin_fill" and "end_fill" to easily mark the area of the source code that
is later to be filled with color. This doesn't work with Small Basic. You
can only draw lines, but it is not possible to fill the forms with colors.
I would love it if you could extend the power of turtle programming for
sVB. This would give you many more options when programming the turtle.
It's great that you have further developed Small Basic and that there is
also a thick manual for it. You will have invested a lot of work. Respect!!!
Kind regards from Germany ... Gregor
Hallo Mohammad,
ich werde deine sVB-Referenz studieren, aber es wird eine Weile dauern, bis
ich das geschafft habe. Vermutlich ist Small Visual Basic viel
leistungsfähiger als Small Basic. Ich habe schon gesehen, dass es bei sVB
auch Argumente und Parameter bei den Prozeduren gibt, was ich bei Small
Basic sehr vermisse. Es gibt dadurch lokale und globale Variablen bei sVB,
womit man viel besser programmieren kann.
Ist es möglich, dass du mal bei sVB die Fähigkeiten der
Turtle-Programmierung erweiterst? Wenn du dir das Modul "turtle" für Python
anschaust, wirst du feststellen, dass es dort viel mehr Methoden gibt. So
ist es möglich, ganz einfach mit "begin_fill" und "end_fill" den Bereich
des Quellcodes zu markieren, der später farbig gefüllt werden soll. Mit
Small Basic funktioniert das nicht. Man kann nur Formen zeichnen, aber
nicht farbig füllen. Ich fände es toll, wenn du die Leistungsfähigkeit der
Turtle Programmierung für sVB erweitern könntest. Dadurch hätte man viel
mehr Möglichkeiten bei der Turtle Programmierung.
Toll, dass du Small Basic weiterentwickelt hast und dass es auch ein dickes
Handbuch dafür gibt. Du wirst sehr viel Arbeit investiert haben. Respekt!!!
Herzliche Grüße ... Gregor
Am Di., 16. Mai 2023 um 09:01 Uhr schrieb Mohammad Hamdy Ghanem <
***@***.***>:
… @boa2145 <https://github.com/boa2145>
You can increase the turtle speed:
Turtle.Speed = 10
But the turtle will always be relatively slow. It is meant to be fun for
kids, not a very practical drawing tool.
—
Reply to this email directly, view it on GitHub
<#192 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3D5YMTK653PPIRER7VORI3XGMQ5TANCNFSM6AAAAAAQO5FJ4M>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I forgot: You can find me on Tumblr. I have three programming blogs there.
My topics are programming, education, learning and teaching. I am not a
professional programmer, but I love programming in the context of learning
and teaching. Last not least I am an old Basic and nowadays a Python
enthusiast.
1. basic-retro-programming, 2. small-basic-programming and 3.
python-programming-language
Am Di., 16. Mai 2023 um 09:01 Uhr schrieb Mohammad Hamdy Ghanem <
***@***.***>:
… @boa2145 <https://github.com/boa2145>
You can increase the turtle speed:
Turtle.Speed = 10
But the turtle will always be relatively slow. It is meant to be fun for
kids, not a very practical drawing tool.
—
Reply to this email directly, view it on GitHub
<#192 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3D5YMTK653PPIRER7VORI3XGMQ5TANCNFSM6AAAAAAQO5FJ4M>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@boa2145 |
@boa2145 X = Turtle.X
Y = Turtle.Y
Turtle.CreateFigure()
Turtle.Move(200)
Turtle.TurnRight()
Turtle.Move(200)
Turtle.TurnRight()
Turtle.Move(200)
Turtle.TurnRight()
Turtle.Move(200)
Turtle.FillFigure()
Turtle.CreateFigure()
Turtle.TurnLeft()
Turtle.Move(200)
Turtle.MoveTo(200, 200)
Turtle.MoveTo(350, 200)
Turtle.MoveTo(X, Y)
GraphicsWindow.BrushColor = Colors.Red
Turtle.FillFigure() |
Hello Mohammad,
Thank you very much for your new turtle feature to fill shapes with color.
I am very happy that you implemented it so quickly. I enclose 2 screenshots
and sb-files to demonstrate the two different five stars and you see the
effect. Then I enclose an IDE screenshot. You can see on the top left that
the font is double. Is that right?
Kind regards and thanks for your support ... Gregor alias boa2145
Am So., 21. Mai 2023 um 13:17 Uhr schrieb Mohammad Hamdy Ghanem <
***@***.***>:
… @boa2145 <https://github.com/boa2145>
It's done. You can install sVB v2.8.4
<https://marketplace.visualstudio.com/manage/publishers/modernvbnet?src=ModernVBNET.sVBInstaller>,
where you can use the turtle can fill an area, by calling the CreateFigure
and FillFigure methods.
X = Turtle.XY = Turtle.Y
Turtle.CreateFigure()Turtle.Move(200)Turtle.TurnRight()Turtle.Move(200)Turtle.TurnRight()Turtle.Move(200)Turtle.TurnRight()Turtle.Move(200)Turtle.FillFigure()
Turtle.CreateFigure()Turtle.TurnLeft()Turtle.Move(200)Turtle.MoveTo(200, 200)Turtle.MoveTo(350, 200)Turtle.MoveTo(X, Y)GraphicsWindow.BrushColor = Colors.RedTurtle.FillFigure()
[image: image]
<https://user-images.githubusercontent.com/48354902/239737101-42b207a9-1038-4f05-b206-792fffef3257.png>
—
Reply to this email directly, view it on GitHub
<#192 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3D5YMRUZ34BI7V5HRZSM7DXHH2VBANCNFSM6AAAAAAQO5FJ4M>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@boa2145 |
Hello Mohammad,
Thanks for your hint. GitHub is a bit confusing for me, but I will send you
my ideas, improving suggestions and replies to sVB issues on GitHub. I
really appreciate your helpfulness and motivation. I will read your sVB
reference book completely.
Kind regards ... Gregor 😊
Mohammad Hamdy Ghanem ***@***.***> schrieb am So., 21. Mai
2023, 22:07:
… @boa2145 <https://github.com/boa2145>
Note that you are replaying to GitHub no to my email, so, nothing is
attached. You need to open this issue in GitHub and post any code and
images you want.
—
Reply to this email directly, view it on GitHub
<#192 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3D5YMSU7WMPLKIGIDBBRKLXHJYXTANCNFSM6AAAAAAQO5FJ4M>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
In SMALL BASIC I can draw various geometric figures, e.g. square, rectangle, circle, ellipse and triangle and fill them in with color. However, it is not possible to draw a n-star or a n-gon, for example. I can only create stars and n-gons with the turtle graphics, but then I have the problem of not being able to fill the figure with color. That's only possible with turtle-tricks, but the filled area is not 100% because of the free corners by the turtle drawing method. It would be very nice if SMALL BASIC provided more methods with which one could draw stars, any n-gons or even free figures and fill them in with colors.
The text was updated successfully, but these errors were encountered: