Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
First project (newbie)
#1
Hello! I decided to jump into Python the other day, and after going through a "basics" tutorial, I chose what I thought was a manageable first project.

My project involves using pyCurl to grab an aviation METAR/weather report, parse it for the two values I want/need, convert the data as necessary, then display the data in a dialog window (using GTK).

The good news, is that (even if the code is very ugly and could obviously be done much better in basically every way) I achieved the basic result I was shooting for. The data appears as I hoped it would, in a gtk dialog window.

However, I would like to improve the project as follows:
1. Set a timer or loop of some type - so that the program would re-run the pyCurl and parsing/etc functions every fifteen minutes (this would be a straight Python issue)
2. Update the "label" in the GTK dialog window to reflect the updated data (This would be a GTK issue).

Currently, I'm most interested in item #1 listed above - figuring out the best way (least-resource-intensive way) to achieve the results I'm looking for. If the best way would be to use a cron job to terminate/re-run the script - that's fine too. I'm just looking for suggestions on ways to handle this issue, and hoping to learn more in the process.

My hope is to continue working on this project after the stated improvements have been implemented, learning how to "clean up" my code and learn good habits for Python coding. Any help or suggestions would be greatly appreciated.

I'd be happy to share code snippets if they would be helpful in any way in suggesting a direction I should take.

Thanks!
Fuzzy
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020