I need some help writing a simple graphical app

Discuss Programming
User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Thu Jul 28, 2005 12:48 pm

Luckily my cable connection has been down for an entire week so I have been able to get a lot of programming done on it. :) I have pretty much finished that app and have been spending most of my time finishing up the web portion of it. I'm almost thinking about starting a sourceforge project out of it, not that there are probably many Linux coding hill climbing dirt bikers out there. :) I've just been very busy writing it because I want to whole system to be finished by Sunday (It's actually quite adequate in it's current state) which is when I'll take it up to the club and get the light installed and test out the system. The next climb is the following Saturday so I'll have a week to fix any bugs I find. I'll try and get some screen shots up by saturday and maybe put up all the source for both the Tk app and the web database. I also now have 3 laptops all capable of 1024x768 , 256MB of RAM, and wireless so I expect things to go great.

The brains of the whole thing are the oldest and slowest laptop running at 366Mhz. That machine runs the Tk app, the database, the web server, dhcpd, and named. Everything "could" be done from this one laptop but having more than one with more than one person running things will make life so much easier. I have everything coded and working but I really threw it together fast and would like to go back and actually rewrite things that are poorly written and designed. It certainly can be improved upon cosmetically too but in it's current form it will save me a *HUGE* amount of work over doing everything in a spreadsheet by myself. The last two years have been killing me.

It will also help the announcer because I put all of the interesting information up on this Tk app for him. It lists the rider when they come up, where they are from, their age, their sponsors if they have them, their last time if it's not their first run, the time to beat in the class, the fastest time of the night, whether they move into 1st place in the class after the run, etc, etc. I'll get everything up here sooner or later.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Fri Jul 29, 2005 1:19 am

Here are some screenshots of the Tk app:

http://voidmain.is-a-geek.org/i/hts1.png
http://voidmain.is-a-geek.org/i/hts2.png
http://voidmain.is-a-geek.org/i/hts3.png

The web interface is actually a bigger piece of the puzzle but the Tk app is the brain and time recorder.

I'll try and get the code cleaned up for both and get them up.

ZiaTioN
administrator
administrator
Posts: 460
Joined: Tue Apr 08, 2003 3:28 pm
Contact:

Post by ZiaTioN » Sat Jul 30, 2005 8:46 am

You are quiet professional and knowledgable for an 11 year old. Are you sure that YZ85 is not too much bike for you? LOL!!!

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Sat Jul 30, 2005 9:20 am

Heh heh, yeah you can multiply that age by 3 or 4 (much closer to 4) and I actually have a YZ250. My friends can't talk me into switching over to the 4-stroke 450 or 525. Something about not being able to teach an old dog new tricks. :)

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Sat Jul 30, 2005 10:40 pm

Ok, here it is:
http://voidmain.is-a-geek.net/hts/

Keep in mind this is very rough. I just threw it together with no major planning as I didn't have a lot of time. It should be more than usable for the climb next weekend and I will be testing it at the club tomorrow morning.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Mon Aug 01, 2005 6:03 am

The tests went excellent. There is only one minor thing that annoys me slightly. If I have to enter a footage I must press the "Enter Feet/Time" button in order for the time to be entered. I would like to be able to just press the "ENTER" key while in the foot input box and have it automatically push the button (or take the equivalent action as if I had pressed the button). I can tab to the button and press the spacebar to click it but it's unecessary steps in my opinion. I must be missing something simple.

Also, I have it set up so when I press the tab the focus switches between the rider selection box, the foot input and the foot button. If I can make it so the button press is not required I would take the button out of the focus list. There is also one other small annoyance with the focus. There currently is a 4th thing that gets the focus but I can't figure out what that 4th thing is. I would like to eliminate that if I could figure it out. That is when I tab it cycles between the 3 things I mentioned earlier and tabbing one more time it appears nothing has the focus. Maybe I have to add a focusNext somewhere.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Mon Aug 01, 2005 3:36 pm

I figured out how to capture the "ENTER" key after entering the feet. I have to use "bind()". I have a feeling I'll figure out the focus thing pronto too.

ZiaTioN
administrator
administrator
Posts: 460
Joined: Tue Apr 08, 2003 3:28 pm
Contact:

Post by ZiaTioN » Tue Aug 02, 2005 6:22 am

Yeah Tk is great for making custom bindings. You just have to bind it to either widget that will have the focus or ALL widgets so it wont matter which one has the focus. The fourth thing that takes the foucs that you can not see is more then likely the main window widget.

As for skipping a widget when tabbing you can set the "takefocus" value to 0 when constructing the widget.

-takefocus => 0,

This will tell the application to skip this widget all together when using keyboard traversal.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Aug 02, 2005 6:31 am

I knew that about the takefocus and I was already using it on other widgets but there was one getting focus that I couldn't find. I figured it out though. I was using the "Scrolled('TList', blah blah)" and I found out if I use just TList('blah') + $tlist->Scrollbar(-takefocus=>0, blah) it works the way I want. Funny I had it that way originally and then switched to just the "Scrollbar('TList')" as it seemed less chatty. So maybe there was a way to stop the extra item in that widget (whatever that was) from getting focus but I couldn't figure it out. Oh well, I have both of those little annoying issues solved. Now I can tab between the 3 but only require one tab to get from the TList to the Entry and then entering a footage and pressing "ENTER" returns focus to the TList so the button isn't required but you can tab to it if you wish.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Wed Aug 03, 2005 12:44 pm

I just realized why my fonts looked so crappy, and probably why the geometry is all off between my configuration and your configuration. The perl-Tk package I have installed from Dag's site doesn't have XFT enabled. I rebuilt the RPM with XFT support and now the fonts look great, but the geometry is all off so I have to go through and adjust everything accordingly this evening.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Wed Aug 03, 2005 8:25 pm

Ok, now the fonts are much smoother:

http://voidmain.is-a-geek.net/hts/images/hts-full.png

That was bugging me!

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Thu Aug 04, 2005 11:30 am

The one last thing that bugs me is the sizing/resizing and the anchoring of frames to their surrounding areas. For instance, if I make the main window larger than what I have it hardcoded to all the frames get gaps around their edges. I wish there was a way to make them "stick" to each other. I thought things like "-anchor" and "-pad" were supposed to take care of that sort of thing but I can't get them to work that way. Basically I would like to allow some of the frames to expand/enlarge automatically if I make the main window larger so that all space is filled by my sub frames. I haven't figured out how to make that happen.

EDIT: Never mind. "-expand=>1" in the pack options fixes it. Duh!!

http://www.unix.org.ua/orelly/perl/cookbook/ch15_17.htm

ZiaTioN
administrator
administrator
Posts: 460
Joined: Tue Apr 08, 2003 3:28 pm
Contact:

Post by ZiaTioN » Thu Aug 04, 2005 2:12 pm

LOL..

I was going to say that the example I gave you way back on the first page of this thread had this feature. =P

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Thu Aug 04, 2005 2:22 pm

Just for grins I ran it under Windows (ewww) with the copy I have now and the geometry all works well (as long as you have the lcd fonts installed, they are key). I'm going to try and button up the resolutions as much as possible so it will work nicely in most resolutions and then I'll stick up the new code.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Sun Aug 07, 2005 5:57 pm

We had our hillclimb last night and everything went really well. I do have a few bugs that need to be squashed and I realize some areas that need to be enhanced but overall things were MUCH easier on me. I actually had a few other people (including my son) run everything for the most part. There were a few glitches that needed to be solved by me though.

I did have one near major problem that wasn't related to the apps. I couldn't get the LaserJet 1200 to work and we had to hold up the start of the show because of it. I had entered all the rider data into the database during signup and then I went to print off all the class sheets so we could have a manual time keeper enter times for a backup in case something happened to the computer. Well the printer wouldn't print and I was getting extremely frantic. I had tested the thing 1,000 times before with no problems, why was it now broke?

I jiggled the cord going into the back of the printer and something seemed loose and rattly. I pulled the side cover off and realized the printer cable had pulled out of it's plug inside the printer. Shew, Disaster averted!! I had 20 bikes staged and ready to go and 1,000 people wanting the show to start and I wouldn't let them start because the printer was broke. :)

Post Reply