Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Once you have installed wxPython you can run the included wxDemo appand have a look at the included LED numeric control.

2019-08-09_145855.jpg

rproffitt commented: Now you're going to have me check out if there's a Nixie Tube version. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you google it you will find a link on Amazon. If you want to just download it then we don't help you with that here. You can start with the online w3 tutorial for free.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I don't know your current skill set, but I found Joe Cielko's SQL for Smarties an excellent book.

le5691 commented: Also, SQL for Dummies. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Late addition - it's always nice to give the user a little help. In the Controls class __init__ you can add

    self.buttons['Solve'  ].SetToolTip("Click to begin solving")
    self.buttons['Undo'   ].SetToolTip("Click to undo the last move")
    self.buttons['Reset'  ].SetToolTip("Click to undo all moves")
    self.buttons['Clear'  ].SetToolTip("Click to enter a new puzzle")
    self.buttons['Check'  ].SetToolTip("Click to check if puzzle is solved")
    self.buttons['Preset' ].SetToolTip("Click to load a random puzzle")
    self.buttons['Inspect'].SetToolTip("Click to display object explorer")
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Python-wxPython Tutorial

This tutorial will take you through the basics of wxPython.

Introduction:

Let's face it. I am a dinosaur. I got my computer science degree in the mid 70s. And it won't be long before I am in my mid 70s. So why am I trying to learn Python? Mostly because learning new things keeps my brain active. And besides, nobody on Daniweb seems to be asking questions about vb.Net anymore. So I thought I'd give it a try. After a few weeks of puttering I managed to learn enough Python to rewrite all of my vbscripts (stop laughing, it's an actual language). Now that I was comfortable (but still not fluent) in Python I decided to really torture myself and tackle wxPython. I had gotten used to creating GUIs in vb.Net by just dragging and dropping controls in Visual Studio. I was spoiled. With wxPython I would have to craft my interface by hand with no automatic code generation. It reminded me of the old days writing apps in Presentation Manager for OS/2.

For those of you not familiar with wxPython, it is essentially a wrapper for the wxWidgets toolkit, a free and open source, cross-platform library for creating GUIs. wxWidgets has been around since 1992. wxPython allows access to wxWidgets from Python. While tkinter (which is badly out of date) renders controls in a generic style (no matter the platform), wxWidgets renders controls in the style of the platform on which it is running so …

rproffitt commented: Excellent article. I'm going to mention Zork to my kids soon. What will happen? +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Simple solution

import wx
import wx.lib.mixins.inspection

RPAD = (wx.TOP , 0, wx.BOTTOM)
CPAD = (wx.LEFT, 0, wx.RIGHT)

PANEBORDER =  15
TILEBORDER =  10      

class App(wx.App):

    def OnInit(self):

        self.frame = Frame()
        self.frame.Position = (10,10)
        self.frame.Show()
        return True

class Frame(wx.Frame):

    def __init__(self):

        wx.Frame.__init__(self, None, title="Sudoku", style=wx.CLOSE_BOX | wx.CAPTION)

        self.SetBackgroundColour('white')

        self.puzzle = Puzzle(self)
        bsizer = wx.BoxSizer(wx.HORIZONTAL)
        bsizer.Add(self.puzzle,0,wx.ALL,10)
        self.SetSizerAndFit(bsizer)

class Puzzle(wx.Panel):

    def __init__(self, parent):

        wx.Panel.__init__(self, parent, -1, style=wx.BORDER_DOUBLE)
        self.SetBackgroundColour('light grey')  

        gsizer = wx.GridSizer(cols=3, vgap=5, hgap=5)

        for row in (0,1,2):
            for col in (0,1,2):
                pane = Pane(self)
                flags = RPAD[row] | CPAD[col] | wx.ALIGN_CENTRE
                gsizer.Add(pane, 0, flags, border=PANEBORDER)

        self.SetSizerAndFit(gsizer)

class Pane(wx.Panel):

    def __init__(self, parent):

        wx.Panel.__init__(self, parent, -1, style=wx.BORDER_DOUBLE)

        self.SetBackgroundColour('yellow')  

        gsizer = wx.GridSizer(cols=3, vgap=5, hgap=5)

        for row in (0,1,2):
            for col in (0,1,2):
                tile = Tile(self)
                flags = RPAD[row] | CPAD[col] | wx.ALIGN_CENTRE
                gsizer.Add(tile, 0, flags, border=TILEBORDER)

        self.SetSizerAndFit(gsizer)

class Tile(wx.Panel):

    def __init__(self, parent):

        wx.Panel.__init__(self, parent, -1, style=wx.BORDER_DOUBLE)

        gsizer = wx.GridSizer(cols=3, vgap=0, hgap=0) 

        for i in range(1,10): 
            button = wx.Button(self,label = str(i), size=(24,24))
            gsizer.Add(button,0,0,0)      

        self.SetSizerAndFit(gsizer)  

if __name__ == '__main__':
    app = App(False) 
    wx.lib.inspection.InspectionTool().Show()
    app.MainLoop()
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I strongly recommend starting with the user interface. In my experience, it doesn't matter, from the user's perspective, what's under the hood if the part the user sees is confusing or just butt ugly. Yes, the hidden stuff is critical, but the customer will likely refuse anything that

  1. Doesn't please the eye
  2. Makes them feel stupid

An interface that makes the user feel stupid is an interface that has failed. With prototyping, an interface is generally easy to create (of course, the prototype will not have any business logic behind it) and a little back and forth with the user will generally allow for some tweaking early in the design process. I did this for one major software project (a Load Advisory Program for optimizing generation and transmission of high voltage DC power). Once I had approval from the users for the mock up I was able to program the guts. In a lot of cases, there will be "gut" modules that you will be able to develop in parallel that will be required no matter what the UI design ends up being.

I highly recommend you read About Face 3: The Essentials of Interaction Design by Alan Cooper, Robert Reimann, and Dave Cronin.

JamesCherrill commented: Yes, yes and yes again. +15
rproffitt commented: Yes. Reminds me of the book "The HP Way." Too bad HP appears to have lost their way today. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

All you are doing is setting a hidden propertyt to a list of one string. The fact that the string has the value 'base' is of no consequence. Set it to some other value and you will get the same result for foo.__base__.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Unfortunately, in most cases, Industry expects that age also comes with experience. That's why people "of a certain age" who are trying to start a new career in programming may find it difficult to get a job in this field. You are not likely to find work if all you've done is read a "Sam's Learn to Program in 21 Days" book. Like most things, you can learn to do it well (which takes a lot of time and effort) or you can learn to enjoy doing it poorly. One might get you a job. The other will not.

rproffitt commented: My short story. Company was not interested in older programmers as they tend to want better code rather churn it out. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

For learning Python I highly recommend the book

Beginning Python From Novice to Professional (3rd Edition - Apress)
Magnus Lie Hetland
ISBN-13 (pbk): 978-1-4842-0029-2
ISBN-13 (electronic): 978-1-4842-0028-5

I've read several books on learning Python and this one is by far the best.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

My summer project is also to learn Python. As such I've been busy converting all of my vbScript maintenance scripts. Feel free to post any Python questions and we'll try to help. I have found a few things frustrating but I've managed to work through most of them. I am currently wrestling with wxPython.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You have four lists. One is the master list and the others are specialty lists. There is no guarantee that a person will be added to anything but the master list, and may be added to only one of the specialty lists. However, when you do a create_assignment, you remove the person from every specialty list. I suggest you either test to see if the person is in a list before doing the remove, or put each remove into a try/except block. Probably more concise if you just do the test.

if micleft_assign in mic_list:
    mic_list.remove(micright_assign)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's been out for several weeks. If you want to know what is new then google "what's new in windows 10 2019 update". Aside from a minor VPN problem there is nothing that should stop you from updating.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

That's pretty low level stuff that you should be able to handle just by rereading your class notes. If you don't know how to flowchart a simple if-then structure then you've probably been sleeping in class.

What, specifically, is giving you problems?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

"Driver Hell" is real

To be fair, it's much easier for Apple to minimize driver problems when they have complete control over the hardware. Microsoft can only provide the interface, then hope that the hardware manufacturers follow the rules when it comes to writing the drivers. Of course, that also depends on Microsoft providing proper (complete) documentation, and we know their record on that score.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I posted code that will do that. It's the only solution you have so far so use it until something better comes along. I tested it with the xml text that you provided, and requesting the fields you specified. I loaded the test data with

txtXML.Text = My.Computer.FileSystem.ReadAllText("D:\test.xml")

2019-06-26_111457.jpg

2019-06-26_111253.jpg

2019-06-26_111309.jpg

cheikh06 commented: thank you very much it works well with your function +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Dang. I always complain when other people do this and now I did it. I left out the import when I posted the code. Please add the following:

Imports System.Text.RegularExpressions

I'll see if I can figure out the Linq version. I'll post it later if I have any luck.

cheikh06 commented: Thank you for your help with this function but it returns me not found +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I've never had much luck working with XML and I'm sure there is a better way to do this via Linq but you could try a regular expression approace as in

Private Function GetField(name As String) As String

    Dim pattern = name & "=""(.*?)"""
    Dim rex = New Regex(pattern)
    Dim match = rex.Matches(txtXML.Text)

    Try
        Return match(0).Groups(1).Value
    Catch ex As Exception
        Return "not found"
    End Try

End Function

Pass it a field name like "supercollection name" (case sensitive) and it will return a field value as a string. If you want someone to post a Linq solution you'll have to post a complete xml sample document.

rproffitt commented: This is my story. Client hands me XML, Microsoft XMLreader blows up. I parse it with my own code. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

For future reference, Code Snippet is meant for posting working and documented snippets of code. It is not to be used when you are posting a piece of code that you are having problems with. Please post under Discussion/Question.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You are allowed to edit your post within 30 minutes of iniitially posting it.

Gloak commented: I don't like it... I was planning to delete and post the same thing again... but I can't. +2
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's not my favourite interface but you can't please everyone. Personally, for short posts I just create the post in TextPad then copy/paste into Daniweb. For anything longer I create the post in MarkdownPad, then copy/paste. It allows me to get the formatting right before posting and it also keeps me from losing a partial post if something locks up.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Do you really think this 9-year-old post warrants further input?

rproffitt commented: Some think it does. I disagree with cause here. My findings were the lack fo Pb in the solder. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I know nothing about the package you are using, but since the problem is with a conversion you could try taking

return int(projectionMatrix.reshape(projectionMatrix.shape[0] / self.numberOfDotsPerFrame, self.numberOfDotsPerFrame, 2))

and break it down into components like

a = projectionMatrix.shape[0]
b = self.numberOfDotsPerFrame
c = projectionMatrix.reshape((a/b, b, 2)

print("a=",a,"type=",type(a))
print("b=",b,"type=",type(b))
print("c=",c,"type=",type(c))

return int(projectionMatrix.reshape(a / b, b, 2))   

That might give you more information on the exact problem.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Unfortunately, movies and TV have co-opted the term to mean anyone who is capable of gaining unauthorized access to a system in under two minutes, even a completely unfamiliar system. The hacker is basically the movie/TV version of deus ex machina. Check out Die Hard 4 and just about any episode of How to Get Away With Murder.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Have you considered it might be because your key has a space? Look at the following:

>>> data_2012 = {}
>>> data_2012['DeathRate '] = "some data"
>>> data_2012['DeathRate ']
'some data'
>>> data_2012['DeathRate']
Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    data_2012['DeathRate']
KeyError: 'DeathRate'
>>> 

You might avoid spurious spaces by using

data_2012[key.strip()] = value
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

As I continue my conversion from vbScript to Python I am finding the gotchas. For example...

A lot of my utility scripts take a file name or a file pattern as a parameter. My script, bitrate.vbs, for example allows me to invoke it as

bitrate file
bitrate pattern

Technically file and pattern are identical since specifying a file is really just specifying a pattern that matches up to one file. To get file listings in vbScript I would just spawn a dos dir command and grab the output from stdout. In Python, however, they provide what I thought was a great module named glob. So a lot of my code looked like

for file in glob.glob(pattern):

I had rewritten five scripts before I got bitten. Let's take a folder that has videos named like

Piano Recital [1994].mp4
Awards Day [1994].mp4
Betula Lake [1983].mp4

glob.glob("*.mp4") gives the expected result

['Awards Day [1994].mp4', 'Betula Lake [1983].mp4', 'Piano Recital [1994].mp4']

so if I were to run bitrate *.mp4 I would process the expected set of files. But if I want the bitrate of only one file and type bitrate "Awards Day [1994].mp4" I get nothing because the result of `glob.glob("Awards Day [1994].mp4") is

[]

And there is a (semi) valid reason for this. glob allows you to use character classes (a subset of regular expressions) in file patterns and [ and ] are used to delimit character classes. Fortunately, glob also provides an escape method in case your file name contains these delimiters. …

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I've only looked at a few pages

Then you have read more of the report than most of the Republicans in either House.

rproffitt commented: So there's a chance I could win a House seat? +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I installed pyCharm and found it difficult to get used to. I found the debugging capabilities of Visual Studio 2019 much more intuitive.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

As a further note, there is a py.exe and a pyw.exe in the C:\Windows folder which are the executables for the 3.7 python. Nice of Microsoft to rename them so that when I went looking for conflicting python.exe versions they didn't show up. <rude word> off Microsoft.

rproffitt commented: "Embrace, extend, extinguish." I can hear it now. "We changed it for security reasons." And thanks since I didn't know that. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's a combination of syntax and addressing. Try

const int NUMSTUDENTS = 10;

int main()
{
    int marks[2][NUMSTUDENTS];
    printf("Enter the marks of the %d students :\n",NUMSTUDENTS);

    for (int i = 0; i < NUMSTUDENTS; i++)
    {
        printf("\nEnter the marks of student :%d", i+1);
        printf("\nAssignment Mark :");
        scanf("%d", &marks[0][i]);
        printf("Exam Mark :");
        scanf("%d", &marks[1][i]);
    }
    printf("****************************************************************\n");
    for (int i = 0; i < NUMSTUDENTS; i++)
    {
        printf("Student No :%d\n", i+1);
        printf("Assignment Marks :%d\n", marks[0][i]);
        printf("Exam Marks :%d\n", marks[1][i]);
    }
    getchar();
    return 0;
}

Please note that I replaced the literal 10 with NUMSTUDENTS. You should really break the habit of hard coding literals. If you had a longer program with a 10 sprinkled throughout you could easily bury yourself in bugs if you later had to change the 10 to some other value. And you might end up changing a non-related 10 by mistake. The const NUMSTUDENTS is clear and unambiguous.

Malpractice makes malperfect.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I set PYTHONPATH to d:\include and I can do

from include import getargs

or

import getargs

but I'd have to refer to the function as getargs.getargs(...). If I want to avoid the double name I have to do

from getargs import *

but I'd prefer to have an import statement that includes the word include to make it easier (grep) to identify my includes.

grep -i "from include import" *.py
pietvo commented: from include.getargs import getargs +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

There is a lot of the same old mindless drivel about SEO, backlinks and such, and a lot of homework posting. There was one interesting discussion a while back in the former geeks-lounge re Quebec's proposed religious symbols legislation. Aside from java questions (which I am not qualified to answer) there hasn't been much going on outside of pharma-banning and necro-posting.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

it just told me no such command exists

You'd either have to:

  1. Run it from the folder containing the executable
  2. Run it from another folder but fully qualify the executable
  3. Place the executable in a folder contained in your PATH environment variable

I have a folder namedf D:\Utils and have added it to PATH. That way any custom command line apps I write or download can be placed there and accessible from anywhere.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You use it like it says.

nlist_it filename.ext

Run it with the name of a text file as a parameter and it will list that file to the console. I compiled and ran it and it works as it is supposed to.

By the way, no book will teach you a language in 21 days.

rproffitt commented: Or how to use the command line or what the command line is and all you can command on the command line. ;) +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Welcome to Daniweb.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In keeping with tradition, Microsoft has released the latest update before resolving a number of outstanding issues. But at least they now provide a more centralized location for getting update information. The home page (dashboard) can be found here and the specific page for the latest update can be found here.

Steven1142 commented: I believe they have also launch a software to run after the updates +0
superhai commented: good +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Agreed. There are computing problems for which you want to carefully pick:

  1. The most efficient algorithm
  2. The most optimized programming language
  3. The fastest hardware/OS platform

But to worry about the above for the OP's problem is a complete waste of time.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

What kind of help are you looking for? If you need it ASAP then I suggest you provide the following ASAP

  1. Proof that you have put some effort into doing it yourself
  2. Indication as to where you are having a problem

So far the only effort I have seen is you copying/pasting your homework assignment.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Generally, a control will have a Visible property. Just set it to False.

rproffitt commented: Nice when controls over the years have begun to have commonalities like that. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can use Virtual CloneDrive by Elaborate Bytes. It is freeware. I used it for years on Windows 7. It allows you to mount an iso (actually several formats of images) as a drive.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Avoid

I had pretty much come to the same conclusion.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Better for what?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can fnd all that at Rosetta Code. Keep in mind that if this if for an assignment then you will likely get caught plagiarizing if you use it. I you just copy/paste someone else's code you won't learn anything.

rproffitt commented: Rosetta Code is a gold mine. Unless gold can't be used. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Daniweb does allow you to edit a post but only within a 30 minute window of when you first posted it. This allows you to make corrections to things that you notice (if you are like me) immediately after you click "Post". If you need to add further information outside of the window you can always add another post to the thread explaining the addition or correction.

misstj555 commented: That's also true. After all, I guess if you don't catch the mistake before the 30 minutes then you can explain your mistake in the "thread". +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Looks like Trump is going to pull out the next tool in the GOP bag-o-tricks. If your popularity is tanking and the wolves are at the door, start a war. After all, it's unpatriotic to attack the president during wartime. This time it will be Iran.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Perhaps if you tell us where you are stuck we can offer some suggestions. What have you done so far?

plump23$ commented: nothing don't know how to was hoping someone would help with the whole code +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Pretty much the same as James. Also retired with too may years of experience under my belt. I like two kinds of questions in particular:

  1. Those I can answer off the top of my head.
  2. Those that I can answer with some effort that give me a chance to learn something new.

As for the above questions...

  1. I always start at https://www.daniweb.com/articles/latest to see the latest posts and check for spam, Then I go through the non-spam and look for questions that I can answer.
  2. I'm pretty much doing all that I want. As a mod I have all the power I can handle.
  3. The effort you get back is related to the effort you put in. The better the quality of the question, the better the quality of the answer.
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You are asked when you start a thread as to where you want to post it. Just pick programming from the drop down.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Here's a completely off the wall idea. Have you considered learning an old programming language? While everyone is concentrating on learning the latest and greatest and trying to keep ahead of the curve, there is still a demand for COBOL programmers. There is a shit-ton of COBOL code still in service with fewer and fewer people available to maintain it. The technology is not nearly as complex as what is required in today's OOP, internet connected world.

rproffitt commented: Great idea. I'll share I'm updating an old VB6 app this week. The client won't update to newer systems. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Can you post your input file please? Also, what are the values of row and clo?

I assume that clo is supposed to be col. If so, I urge you to develop either better typing skills or better proofreading skills. It's simply not sufficient to just spew out a mess of code then ask "why doesn't this work"?

PS: ON and RA are meaningless variables. You should pick better names or comment your code to clarify.

Rahaf_2 commented: the input in file is: Jenin 500 550 450 Tul 400 580 455 Qal 300 550 450 Nab 600 550 460 //clo =3,row=4 +0