Pageviews

Monday, July 18, 2011

kind of a rough week

this past week has been kind of rough. i sprained my ankle pretty bad AND i have been lost in python land trying to convert my scripts to intercommunicating modules. i spent many hours trying to figure this particular problem out:

 i created a class to make a row of checkboxes (class Checkbar) and a method for that class that reports a vector of 0s and 1s for whether a box is unchecked or checked (respectively, method called state). i have a separate function (called POPMENU) that creates an object of this class and this method has an internal method that scans all objects of the Checkbar class and reports the vectors for them all (called allstates). when i run POPMENU, this works fine. but when i embed it in a GUI widget (a Button), the vector always returns zeroes. i figure it has something/everything to do with passing variables or when the instances are created, but i can't quite make it work. i'm uploading the isolated problem in a script called confused.py (to GitHub) if anyone wants to look at it.

this week i've spent a lot of time reading about lambda functions, classes (and their methods) and functions. on the plus side, i've written the "input" portion of the GUI - in other words, i can create a drop down menu that will load the locus files, SAM/BAM files and demographic data into MongoDB. that was rather satisfying and is located in the menu.py script. two other new scripts, called constructionMDB.py and convertingLociNGS.py are being uploaded too. (constructionMDB.py is used by menu.py for the input of files. convertingLociNGS.py isn't being used just yet, and may have to be rewritten, but was a first pass at getting all the reformatting scripts together.)

2 comments:

  1. Sarah;
    Sorry to hear about your ankle; are you still able to get around?

    For your confused.py problem, I believe you want:

    poproot = Toplevel()

    instead of:

    poproot = Tk()

    (and secondarily, should get rid of the extra poproot.mainloop() once you are happy with the window inside of a window view).

    I'm not a Tkinter expert, but think that the Tk call is creating multiple event loops and confusing things. The Toplevel just pops up a widget instead.

    Feel free to drop me an e-mail or grab me on IRC freenode (chapmanb) if you get stuck on anything. Happy to help reduce confusion and maximize fun,
    Brad

    ReplyDelete
  2. BRILLIANT! that worked perfectly. thanks, brad. i'm now back to the fun part of coding!

    ReplyDelete