Related
I've recently begun trying to create a mobile app (iOS/Android) that will automatically beat match (http://en.wikipedia.org/wiki/Beatmatching) two songs.
I know that this exists out there, and there have been others who have had some success, but I'm running into issues related to the accuracy of the players.
Specifically, I run into "sync" issues where the "beats" don't line up. The various methods used to date are:
Calculate the BPM in advance, identify a "beat" (using something like sonicapi.com), and trying to line up appropriately, and begin a mix in with its playback rate adjusted (tempo adjustment)
Utilizing a bunch of meta data to trigger specific starts and stops
What does NOT work:
Leveraging echonest's API (it beat matches on the server, we want to do it on the client)
Something like pydub (does not do it in realtime)
Who uses this algorithm today:
iwebdj
Traktor
Does anyone have any suggestions on how to solve this problem? I've seen lots of people do it, but doing it in real time on a mobile device seems to be an issue.
There are lots of methods for solving this problem, some of which work better than others. Matthew Davies has published several papers on the matter, among many others. Glancing at this article seems to break down some of the steps necessary for doing this. I built a beat tracker in Matlab (unfortunately...) with a fellow student and our goal was to create an outro/intro between 2 songs so that the tempo was seamless between them. We wanted to do this for songs that varied in BPM by a small amount (+-7 or so BPM between the two). Our method went sort of like this:
Find two songs in our database that had overlapping 'key center'. So lets say 2 songs, both in Am.
Find this particular overlap of key centers between the two. Say 30 seconds into song 1 and 60 seconds into song 2
Now create a beat map, using an onset-detection algorithm with peak picking; Also, this was helpful for us.
Pick the first 'beat' for each track, and overlap the two tracks at that point. Now, since they are slightly different BPM from each other, the beats won't really line up with each other.
From this, we created a sort of map that gave us the sample offsets between beats of song A and beats of song B. From this, we wanted to be able to time-stretch the fade-in region of song B so that each one of its onsets (beats in this case) lined up at the correct sample index as the onsets from song A, over ITS fade-out region. So for example, if onset 2 from song B was shown as 5,000 samples ahead of onset 2 from song A, we simply stretched that 5,000 sample region so that onset 2 matched exactly between both songs.
This seems like it would sound weird, but it actually sounded pretty good. Although this was done entirely offline in Matlab, I am also looking for a way to do this in real-time in a mobile app. Not entirely sure about libraries you can use for this in Android world, but I imagine that it would be most efficient in C++.
A couple of libraries I have come across would be good for prototyping something, or at least studying the source code to get a better understanding of how you could do this in a mobile app:
Essentia (great community, open-source)
Aubio (also seems to be maintained pretty well, open-source)
Additional things to read up on for doing this kind of stuff in iOS land:
vDSP Programming guide
This article may also help
I came across this project that is doing some beat detection. Although it seems pretty out-dated unfortunately, it may offer some additional insights.
Unfortunately it isn't as simple as just 'pressing play' at the same time to align beats, unless you are assuming very specific aspects about them (exact tempos, etc.).
If you reallllly have some time on your hands, you should check out Tristan Jehan's (founder of Echonest) thesis; it is jam packed with algorithms and methods for beat detection, etc.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I realize that to become a better programmer, you need to program!
So obviously the more practice, the better you become.
My problem is this. I am currently in university, and I find my course load is a bit daunting, and I don't have a lot of free time. I don't think I could really take on a big project, particularly I don't think I would have to motivation to see it through, it would be easier just for me to keep putting it off in favour of work that is due is school.
But I still want to practice.
So I am looking for any resources which have programming challenges which can be completed in a fairly small amount of time. Ideally something i could get done in under 10 hours of work (so just over an hour of work each day), if not smaller.
I have heard of Google Code Jam, but I am not sure the length of the programs it specifies, nor the skill level.
Does anyone have suggestions? Even perhaps a compendium of tutorials for different functions might be useful. For example, a tutorial on file IO would be worthwhile (if I didn't already know it), even though it can be a fairly small topic.
You should look into code katas, they do exactly what you are talking about. Short exercises that are designed to perfect your coding/thinking abilities.
Other references:
http://kata.coderdojo.com/wiki/Overview_of_Learning_Resources
Project Euler has some math/number related problems that are very interesting and ranged from easy to very challenging. You can pick your language of choice and submit only the solution (a large integer number). After you submitted the correct solution, you have access to a forum/comment page where others posted their comments and solutions.
From experience I recommend finding a task that you do repetitively and turning it into a program. I also recommend, seriously, re-invent the wheel in order to get practice with programming. Don't let people tell you to not do something just because it exists already. If you don't know how it works, try to write it yourself.
I don't exactly know what programming level you are on, but don't try to do anything too crazy off the bat, that is just a demotivator (such as trying to write a game for the PS3).
If you already can navigate your way around with IO, then you should try to really learn how to use Collections effectively. I think one of the best practice assignments I have ever done was rewriting the Java TreeMap Class. It was a huge challenge and I learned a lot by doing it.
Here are some suggestions for practice assignments:
Take a text file that has a fair amount of information in it, grab anything, you can get something from here if you'd like: http://www.gutenberg.org/ and make a program that will do the following:
Read in the file
Create a collection of words and their occurrences
Create a collection of anagrams
Create a collection of words and the positions in which they occur (line#, word position)
Develop statistics on the words in the file - meaning - treating each word as an individual - which words occur before it and after it.
Remove all of the white space from the file
Write all of the above data to their own files
One of my favorite things to do is mess with web data, go to a polling website, find a page that has poll data in a tabular form and do the following:
Download the data
Parse through the data and turn the tabular data into a CSV file
Open it in excel without error
Or just look for any site and extract data from it, just make sure the site is robot friendly http://www.robotstxt.org/, you don't want any one site to feel like it is under attack. Most of the time though this isn't normally a problem because if you read the site's terms of use it clearly states you are allowed to download 1 copy of whatever it is you are viewing so long as you don't intend to sell it. Of course this changes for every site.
Go to a website and get all of the links off of the page programmatically.
Here is a fun one, the Susan Program (I don't remember why it is named Susan) which I initially wrote using a C program and two Bourne shell scripts in a Unix environment. The idea in this program is to fork 4 child processes and give them each a task like so:
Child 1: Reads in a file, creates a dictionary of each word and its position in the file, this is outputted to a file.
Child 2: Takes Child 1's output and reconstructs the document, this is outputted to a file.
Child 3: Takes Child 2's output and does what child 1 did again
Child 4: Takes Child 3's output and does what child 2 did again
The goal here is to have an exact replica of the original file once Child 4 outputs it. This is challenging and somewhat pointless, but the point of this exercise is to get the practice.
In your case, don't feel that you need to use different threads for this, you can just use a single program with two different functions and just call them in order.
Again, not sure if you are at this level yet, but try to replace any "for" or "foreach" loop you have in your program with recursion, just as practice. Recursion is a pain in the butt, but it is valuable to know and understand.
These are some suggestions which I think will really help you sharpen your skills.
Enjoy
I like SPOJ and Project Euler to take quick programming challenges and exercises.
Code Jam is a good programming contest, although, as you mentioned, most of the problems there aren't for beginners.
There's a good selection of problems from past topcoder algorithm competitions. (They are held ~2 times a month for almost 10 years already, so there're quite a lot.)
Difficulty range from very simple (but still interesting) problems in the 2nd division to very hard.
Additionally, there're editorials with solutions and live environment where you can submit and test your code. You can also learn from submissions by other people.
Check the problem listing.
Another advantage of topcoder is the regular online contests they hold. I find that competing against other people in realtime is a great boost for motivation.
There're many more problem archives, like SPOJ, UVA and Timus, although they rarely provide solutions or even hints.
http://codegolf.stackexchange.com might have some programming challenges to your liking. A lot of the answers on that site are golfed (they implement the program in the least number of characters) but there are definitely some interesting examples to learn from.
Try enrolling on any IT course on the following websites:
Coursera
Edx
Udacity
These websites offer free educational IT programs from prestigious schools wherein there are lot of challenging exercises to sharpen your programming skills. I've learned to program percolation, pattern recognition, bouncing ball and so many more interesting things because of this. You will upload your program upon completion of the exercises and you will be graded accordingly (basically your progam will be checked).
At the end of each course, you will even receive a certificate of completion. Cool Right?
It depends of the language, but in the past http://rubyquiz.com and http://pythonchallenge.com did great for me, also you can join to an open source initiative because usually helps to give you better code review chances.
I've always thought that practicing with sample interview questions was a great way to sharpen one's skills and get exposed to types of problems that you normally wouldn't solve. Plus, if you're going to be looking for a job it helps you even more.
Here's a pretty simple one that I did for fun the other day:
Write a routine to print the numbers 1
to 100 and back to 1 again without
using any loops.
Glassdoor.com has a lot of good interview question submitted by people who actually got them in an interview.
Since you are in University and looking to improve your coding skills the hard-copy book Cracking the Coding Interview might be a good fit for you. It's got great general programming questions and tidbits about interviewing with some of the best companies in tech. Not only are there great questions, but there are decent problem breakdowns as well.
[Disclosure: I own the book but otherwise have no association to it.]
If you like programming and want to improve your programmer skills, you must try cocode.co. It's a social young site, similar to StackOverflow but based on posting and solving programming challenges, instead of asking and answering questions. From very easy challenges to very hard ones.
You can try to solve ACM problems. There are thousands of problems there and you can find the difficulty level so you can choose which problems to do first. The offcial site for this is:
http://uva.onlinejudge.org/. You can learn more there.
regards
arefin
It may seem a little obvious, but I've noticed a real boost in my regular-expressions skills lately just from answering regex questions on Stack Overflow. Teaching forces you to break down problems into easily explainable pieces, and will also guide your research on those occasions where you know most, but not quite all, of a solution.
I suggest finding a topic you're already somewhat proficient in, since this type of thing isn't so good as a beginners' tutorial. Search SO for questions tagged with that topic and try to figure out the answers. Don't just code them in your head; go ahead and write them out, test them, and explain them. If you're not sure your answer is correct, just write it without posting it.
I'm coming to the end of my first year of CS and I thought a great way to consolidate all the things I've learnt this year would be a personal game project.
I would like to implement a 2D based rts, I'm thinking along the lines of starcraft I, warcraft II or even command and conquer. I will have about 3 months without interruptions to implement the game.
So to anyone experienced with java game programming, I have a few questions:
Is it realistic to design a 2D rts engine from scratch in 3 months?
If so what are some good books/resources to get started?
Would it be better to modify some existing project? I would think the experience of having to work with a lot of someone else's code would be good since our exposure to such topics in an undergrad cs degree seems very rare, if non-existent.
Are there any decent open source 2d rts projects that anyone could recommend? I've looked through a few but most seem to be written in c/c++
My humble thanks
Edit: Thanks for the quick responses, I think that perhaps it was a bad idea to post this in a rush since I think I misrepresented what I want to do.
When I say "along the lines of warcraft II etc" I mean more like that style of rts using sprites. I don't intend to implement a game nearly that complex, more like just a basic prototype.
My goal would be some thing more like a flat textured map with some basic obstacles like trees, a single unit producing structure like a barracks. I'd like to have the units to have health bars, be able to move and attack and die (and possible morph into another unit).
Far off goals would be to implement some basic pathing using a modified version of the dijkstra shortest path algorithm, ranged units with missle attack, etc.
I don't plan to implement any opponents or ai or networking or anything like that.
I'm thinking along the lines of starcraft I, warcraft II or even command and conquer
Make sure you purge your mind of matching the full scope of any of those. They took large teams of developers multiple years to make, with multi-million dollar budgets, so you can't even hope to approach those. They're called AAA for a reason. That being said, there's no reason you can't very minimally ape their design, or make a tiny game in their genre, assuming you have previous experience making small games.
A sub-genre of RTS that might be doable in that amount of time is a Tower Defense game. Plants vs Zombies is a good example. The reason I suggest this sub-genre is that you can avoid implementing any sort of AI or path-finding, which are notoriously difficult to get working, and I think technically impossible to implement "perfectly", especially with a limited CPU budget.
Make sure to reign in your scope. Favor a "complete" game over new features, because you can then call it "done" at any time. Get your game playable ASAP, and don't sweat the polish or details until you have to. Add one enemy type and one type of player unit (with only one ability, if you were thinking of implementing multiple abilities per unit). Make a title screen, menus (even if the menu is just "click screen to play"), game over screen, level complete or stat screens, cross-level player statistics, etc. Once you have all that ironed out, spend equal time adding new features and polishing the gameplay/graphics/bugs.
Once you have a playable, "complete" game ready (no matter how small in scope), find a real artist to do graphics for you. A shiny game always draws an audience, no matter how simple the gameplay.
It is very unrealistic to think you could implement a 2D RTS engine anywhere even close to the complexity in those kind of games. You could maybe get something very rough if you were experienced, but with only one year I think it's doubtful.
I can't help but feel like it would be much better for you if you used an existing engine or framework and built off of it. Like you said, working with other code would probably be a good learning experience as well. It would allow you to experiment without getting bogged down in having to do everything.
Keep it simple or you will simply drown in complexity before getting around to have anything playable. Since you have not tried it before, you will have a lot of nuts to crack and you don't know how long they will take.
Also remember that report writing and documentation takes time too.
The idea is good, and I think you can pull off a whole game if you find good building blocks. I would suggest discussing this with your teacher to hear what is acceptable for you to use. Would it e.g. be ok to do a game on an open source engine if you add some non-trivial functionality?
Update: Seems to be several engines available from Java at http://www.devmaster.net/engines/list.php?fid=6&sid=1
People often forget, that creating games is MUCH MORE than just coding the technique thing. Its about content creation, game design, sound and music, the "fun factor". If you make heavy use of existent APIs or engines, it will be possible, but writing it from scratch with no experience in 3 month is like asking yourself if you can code 100,000 LOC in this time which means 1111 LOC per day. This might be possible, but not if you have to desing and think, and just having the code makes no game.
Perhaps it would make sense to look at some existing efforts to get a feel for the scope of what you are looking at. These should give you some ideas or even code to build on:
http://www.duncanjauncey.com/btinternet/old/javagame/game.html
http://en.wikipedia.org/wiki/Lightweight_Java_Game_Library
http://www.ardor3d.com/
http://en.wikipedia.org/wiki/JMonkeyEngine
It would be a lot for me to bite off (from scratch) in the time given that is for sure. That is about all I can say.
EDIT: I thought maybe JOGRE was not what you are looking for. Then I thought about it and it seems like it would have all the right kinds of plumbing for what you are trying to do.
EDIT AGAIN: After my answer, one of the related questions links on the side seemed relevant: Java Game Programming: JOGL vs LWJGL?
Well if it gives you any hope at all, my team and I are currently working on an RTS game called "The Genesis Project". We call ourselves MotherBoard Games, or MBG for short. If you would like, I am always looking for more coders. You can email me at mpmn5891#gmail.com, I can give you some advice and tips form my 6 year experience, 2 of which have been spent making this game (to give you a scope)
What sort of conventions would you advise when doing some distance work (say through CVS or SVN) on a team project? More specifically, what can be done to avoid someone doing widescale changes, which might be necessary, and running the risk of confusing/delaying other team members? If testing is necessary, how should it be carried out so code isn't polluted with instructions that will need to be cleared out before the application is to go into production? I'm interested in anything that has to do with methodology but also any small tips that could enhance communication such as leaving TODO comments in the source code.
Communication is more key than convention. My team is split, half in Europe and half in the US, and our success comes from clear, regular communication:
Daily 15-minute conference call where everyone says the area they are working on. Followed up by an email summary.
Weekly 2-hour video conference where someone presents a complex piece of work.
As lead, I talk through each task with a developer for at least a few minutes before they start, check in with them at least once a day by phone, IM or in person; and expect a brief review when the task is complete. The point is not to check up on them to make sure they did it right* - they wouldn't have been hired if we weren't 100% sure they could.
The point is that ritual communication establishes a baseline habit of regular communication and that keeps everyone in sync. The mandatory bits make everyone comfortable enough to pick up the phone or approach a colleague every time they work on something the other might need to know.
Also, please don't leave TODO comments in source code. Throw a UnsupportedOperationException/NotImplementedException until you're ready to implement, and then implement it fully.
*Right doesn't mean perfect. There's always a better design, better way to code something, and continuous communication facilitates continuous feedback.
I am an undergraduate student. I was exposed to basic programming couple of years back in school. Till now I have an understanding of Core Java, Core Python and basic C and C++.
Every time I start off with some GUI programming so as I can start off with a project of mine, I get boggled by the sheer amount which is to be done, API to be learnt, MVC architecture and everything programmers talk about, event handling etc etc.
Studied awt and swings for a while. Tried my hands on Qt and Gtk, could not find much of documentation. Tried to make sense of pygame. I end up at the same place, knowing the core language.
Tkinter on my zenwalk Linux is broken so could never start it athough I own a book on python with Tkinter explained.
But I end up at the same place, with just the basic understanding of the language.
Want to start over, seriously now. I would like to choose python. How should I go about studying GUI programming?
I need some Internet resources and direction so that I don't end up at the same place!
Since it sounds like you want Python GUI programming, may I suggest PyGTK?
That's probably a pretty good place to start for someone who knows Python and would like to start small on some basic GUI apps. GTK can be complex at times, but with PyGTK there's plenty of open-source example apps you can study, from simple to complex.
Edit: This tutorial from LinuxJournal seems pretty helpful.
Edit 2: Here's the tutorial from PyGTK's site, and another tutorial I randomly found from Google (seems like that whole blog is pretty useful for what you want to do, actually). Finally, the snippet at the bottom of this page might be helpful, courtesy of Ubuntu's forums.
If you are leaning more to games...
I suggest you install Pygame and Python, and go through their tutorials. The pick a simple game or graphics project and program it!
For Python GUIs I like wxPython (www.wxpython.org). It is pretty easy to get started with simple controls and layouts. It is also cross platform. Plenty of tutorials out there. Just search for wxPython tutorial.
I know how you feel--I learned a whole lot of computer programming during my CS degree but very little about GUIs. I ended up teaching myself Cocoa/Objective-C for a project. Cocoa is wonderful for GUI stuff but often a royal pain with a steep learning curve. If you don't have any experience with C programming, don't bother.
First step: familiarize yourself with the MVC (Model/View/Controller) design convention, because nearly every GUI framework will reference it. Google it--there are lots of resources about it. My quick, simple definition is:
The model level defines the data or the logical model for the application. For a web app, that would be the database. For a game, it could be stored data and game logic/rules.
The view level is what the user sees and interacts with (the GUI).
The controller level is the logic that connects the two. For example, the controller knows that when you click the "start game" button in the view level, it does some stuff with the model (say, setting up the board and the players.)
Step two: Figure out what you want. Are you interested in desktop applications specifically? Games? Web apps?
If mostly what you want to do is to be able to develop something that people would actually use, another option is to learn a web development framework. The frameworks make stuff easy for you. I love Django, personally, and if you know a little Python and a little HTML and a little about MVC, you can pick it up quickly. (Just don't be confused, because what Django calls a view is actually a controller.)
If what you want to do is games or graphics/animation stuff, check out pygame. I used it for a class project--basically taught it to myself in a couple of weeks--and it worked great.
I'd say stay as far away as you can from Java Swing/awt/etc.
I've heard good things about wxPython--I almost ended up using it instead of Cocoa, because the wx stuff is available in several programming languages and it's all cross platform.
Good luck! Stay strong! I know it's really intimidating, because I've been in your shoes. You can do it with some work, practice, and motivation.
Many have recommended wxPython, and I second their enthusiasm - it is a great framework; it also includes a serious demo (with code and live applications) which will be extremely valuable for learning.
Now, BEWARE!
It is very simple to confuse the end with the means. Programming GUIs can be extremely attractive but not very productive. In my early days I spent days and days trying to get a simple plotting application (reinventing the wheel); a simple GUI for solving quadratic equations; a simple GUI for calling database queries by clicking on certain locations on a map, etc. During all this time I never actually dug into algorithms or more general and productive computer science and computer engineering topics. In retrospect, I should have. Granted, I did learn a lot and I don't totally regret it, but my advice stands: worry about your algorithm first and about your interface second. This may not apply to every field (I am an engineer for NASA). Nowadays I work with number crunching applications with no GUIs whatsoever; I don't think they need them!
Anyway, I just wanted to share my two cents with GUI programming - have fun but don't overdo it.
What do you mean by "Graphics"? Do you mean game graphics, or do you simply mean user interface code (forms, webpages, that sort of thing)? In the case of game graphics, there's a limit to how simple things can be made, but http://www.gamedev.net, for example, has tons of introductory articles on 2d and 3d engines. For something more along the application line, you might simply download Visual Studio or Eclipse and spend some time looking at the code that is autogenerated by their WYSIWYG editors.
For GUI work in general:
Less is more
GUI work (even in productive frameworks) is about as fun and productive as painting the Eiffel Tower with a toothbrush. Go for a minimal design.
Avoid State Like The Plague
Do you put state in your GUI, or in the model? If you put it in the GUI, you are going to mess yourself up with redundant and inconsistent code paths. If you put it in the model, you risk an overly complex system that gets out of sync when your GUI fails to update from the model. Both suck.
wxPython
If you want to learn wxPython, here are a few traps I noticed:
The tutorial
Use this tutorial - http://wiki.wxpython.org/AnotherTutorial
It's the best one I found.
But remember to toggle line numbers, for easy pasting.
Events
Events are a bit like exceptions, and they are used to make things interactive.
In a vanilla python program, you write something like:
def doit(i):
print 'Doing i = ',i
for i in range(10):
doit()
print 'Results = ',result
In a GUI, you do something like:
def doit(event):
print 'An event',event,'just happened!'
event.Skip()
import wx
app = wx.App()
frame = wx.Frame(None, -1, 'The title goes here')
frame.Bind(wx.EVT_KEY_DOWN, doit)
frame.Show()
app.MainLoop()
Every time the user presses a key down, an event will be raised. Since frame is bound to the event (frame.Bind(wx.EVT_KEY_DOWN, doit)), the function doit will be called with the event as an argument.
Printing to stderr isn't too hot in a gui, but doit could also call up a dialog, or do anything you want it to.
Also, you can generate your own events using timers.
Apps, Frames, Windows, Panels, and Sizers
Everything has a parent. If an event is raised, and the child doesn't skip it (using event.Skip()), then the parent will also have to handle the event. This is analogous to exceptions raising up to higher-level functions.
A wx.App is like the Main function.
wx.Window isn't really used. Stuff inherits from it, and it has all the methods for sizing and layout, but you don't need to know that.
wx.Frame is a floating frame, like the main window in Firefox. You will have main one frame in a basic application. If you want to edit multiple files then you might have more. A wx.Frame won't usually have parents.
wx.Panel is part of a parent window. You can have several panels inside a frame. A panel can have a wx.Frame as a parent, or it might be the child of another panel.
wx.Sizers are used to automatically layout panels inside frames (or other panels).
Code:
def doit1(event):
print 'event 1 happened'
def doit2(event):
print 'event 2 happened'
import wx
app = wx.App()
frame = wx.Frame(None, -1, 'The title goes here')
panel_1 = wx.Panel(frame,-1,style=wx.SIMPLE_BORDER)
panel_2 = wx.Panel(frame,-1,style=wx.SIMPLE_BORDER)
panel_1.Bind(wx.EVT_KEY_DOWN, doit1)
panel_2.Bind(wx.EVT_KEY_DOWN, doit2)
panel_1.SetBackgroundColour(wx.BLACK)
panel_2.SetBackgroundColour(wx.RED)
box = wx.BoxSizer(wx.HORIZONTAL)
box.Add(panel_1,1,wx.EXPAND)
box.Add(panel_2,1,wx.EXPAND)
frame.SetSizer(box)
frame.Show()
app.MainLoop()
I've been really bad, and not used OOP practices. Just remember that even if you hate OO in most contexts, GUI programming is the place where OOP really shines.
The MCV
I don't get MCV. I don' think you need an MCV. I think a MW (model-widget) framework is fine.
For example - 2 frames that edit the same piece of text:
class Model(object):
def __init__(self):
self.value = 'Enter a value'
self.listeners = []
def Add_listener(self,listener):
self.listeners.append(listener)
def Set(self,new_value):
self.value = new_value
for listener in self.listeners:
listener.Update(self.value)
import wx
app = wx.App()
class CVFrame(wx.Frame):
def __init__(self, parent, id, title, model):
wx.Frame.__init__(self, parent, id, title, size = (100,100))
self.button = wx.Button(self, -1, 'Set model value')
self.textctrl = wx.TextCtrl(self, -1,model.value)
self.button.Bind(wx.EVT_BUTTON,self.OnSet)
self.model = model
model.Add_listener(self)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.button,0,wx.EXPAND)
sizer.Add(self.textctrl,1,wx.EXPAND)
self.SetSize((300,100))
self.SetSizer(sizer)
self.Center()
self.Show()
def OnSet(self,event):
self.model.Set(self.textctrl.GetValue())
def Update(self,value):
self.textctrl.SetValue(value)
model = Model()
frame1 = CVFrame(None, -1, 'Frame 1',model)
frame2 = CVFrame(None, -1, 'Frame 2',model)
app.MainLoop()
wxPython has a listener-subscriber framework, which is a better version of the model I just sketched out (it uses weak refs, so deleted listeners don't hang around, and so on), but that should help you get the idea.
If you have already gone through pygame, tk, Qt, and GTK, then really the only thing left that I can think of is pyglet, which I admit I have not tried, but I have read uniformly good things about it.
Still, more than anything it sounds as though you have trouble sticking with a framework long enough to really grok it. May I recommend starting with a small project, such as Pong or Breakout, and only learning as much as you need to make it? Once you have finished one thing, you will have a feel for the library, and continuing past there is a lot easier.
whatever language you choose you will have to deal with the many details involving GUI programing. this is due to the nature of the window based environment usually used for GUI.
what can help you move forward quickly in developing GUI based application is less the language and more the IDE you use. a good IDE can do some part of the less interesting stuff for you letting you focus on the big picture.
with C# in VS 2008 its all about choosing elements and methods from lists boxes. its very easy to get started and have a working project.
you can then try to customize your application to gain better understanding of whats going on behind the scenes
One of the greatest Python GUI you can study from is the source of IDLE. It always comes with Python.
For Java, you could also look into SWT.
While I have never used AWT or Swing, I have read that SWT is the easiest of the three to learn.
Here is a decent comparison between the three.