| | |
Where to get C++ GUI prgramming tutorials?
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
I dont really know it python.......but it looks like this:
thats a code snippet from wifi-radar.
python Syntax (Toggle Plain Text)
def run( self ): self.dialog.show_all() return self.dialog.run() def destroy( self ): self.dialog.destroy() del self.dialog def toggle_use_dhcp( self, widget, data = None ): expanded = self.dhcp_expander.get_expanded() if expanded: self.dhcp_expander.set_label( USE_IP_LABEL ) else: self.dhcp_expander.set_label( USE_DHCP_LABEL ) def toggle_use_wpa( self, widget, data = None ): expanded = self.wpa_expander.get_expanded() if expanded: self.wpa_expander.set_label( USE_WPA_LABEL ) else: self.wpa_expander.set_label( NO_WPA_LABEL ) def get_profile( self ): profile = {} profile['ssid'] = self.ssid.get_text().strip() profile['key'] = self.key.get_text().strip() profile['mode'] = self.get_array_item( self.mode.get_active(), WIFI_MODES ) profile['security'] = self.get_array_item( self.security.get_active(), WIFI_SECURITY ) profile['channel'] = self.get_array_item( self.channel.get_active(), WIFI_CHANNELS ) profile['protocol'] = 'b' profile['signal'] = '0' profile['prescript'] = self.prescript.get_text().strip() profile['postscript'] = self.postscript.get_text().strip() # wpa use_wpa = ( self.wpa_expander.get_expanded() == False ) if use_wpa: profile['use_wpa'] = False else: profile['use_wpa'] = True profile['wpa_driver']= self.wpa_driver.get_text().strip() # dhcp use_dhcp = ( self.dhcp_expander.get_expanded() == False ) if use_dhcp: profile['use_dhcp'] = True else: profile['use_dhcp'] = False profile['ip'] = self.ip.get_text().strip() profile['netmask'] = self.netmask.get_text().strip() profile['gateway'] = self.gw.get_text().strip() profile['domain'] = self.domain.get_text().strip() profile['dns1'] = self.dns1.get_text().strip() profile['dns2'] = self.dns2.get_text().strip() return profile def set_profile( self, profile, known ): if __debug__: print profile self.ssid.set_text( profile['ssid'] ) if known: self.ssid.set_editable( False ) self.dialog.set_title( "WiFi Profile for %s" % profile['ssid'] ) self.key.set_text( profile['key'] ) self.mode.set_active( self.get_array_index( profile['mode'], WIFI_MODES ) ) self.channel.set_active( self.get_array_index( profile['channel'], WIFI_CHANNELS ) ) self.security.set_active( self.get_array_index( profile['security'], WIFI_SECURITY ) ) #self.protocol.set_text( profile['protocol'] ) self.prescript.set_text( profile['prescript'] ) self.postscript.set_text( profile['postscript'] ) # wpa if profile['use_wpa'] == True: self.wpa_expander.set_expanded( True ) self.wpa_driver.set_text( profile['wpa_driver'] ) else: self.wpa_expander.set_expanded( False ) # dhcp if profile['use_dhcp'] == True: self.dhcp_expander.set_expanded( False) else: self.dhcp_expander.set_expanded( True ) self.ip.set_text( profile['ip'] ) self.netmask.set_text( profile['netmask'] ) self.gw.set_text( profile['gateway'] ) self.domain.set_text( profile['domain'] ) self.dns1.set_text( profile['dns1'] ) self.dns2.set_text( profile['dns2'] ) def get_array_index( self, item, array ): try: return array.index( item.strip() ) except: pass return 0 def get_array_item( self, index, array ): try: return array[ index ] except: pass return ''
"Hey ass, don't hijack my thread. This is serious." -JoshSCH
Yes something like that. Python is basically a scripting language which means it is an interpreted language. You don't need to compile the program. Just type and run it !! Thats why Python is used for quick prototyping of small projects.
I don't accept change; I don't deserve to live.
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Its a misconception among many people. They always talk about performance without knowing the actually implications of what they are saying considering 80% of the people who cry about performance run no real test or profile their code.
Come on, I mean there has to be some difference between C and Python. But think of it this way, I would rather write a small text based RPG game in Python in one week and have 95% performance than spend 3 weeks writing it in C and have 100% performance benefits.
With the kind of benefits Python offers over its fast counterparts, its kind of acceptable. I mean, you can't have everything, can you ? ;-)
Come on, I mean there has to be some difference between C and Python. But think of it this way, I would rather write a small text based RPG game in Python in one week and have 95% performance than spend 3 weeks writing it in C and have 100% performance benefits.
With the kind of benefits Python offers over its fast counterparts, its kind of acceptable. I mean, you can't have everything, can you ? ;-)
I don't accept change; I don't deserve to live.
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
•
•
•
•
Originally Posted by s.o.s
Come on, I mean there has to be some difference between C and Python. But think of it this way, I would rather write a small text based RPG game in Python in one week and have 95% performance than spend 3 weeks writing it in C and have 100% performance benefits
•
•
•
•
Originally Posted by ongxizhe
Well, thanks. Any suggestion about some must-know or must-do or must-learn before starting python?
They see "c/c++" as the hardcore programming language and anything other language short of assembly and maybe lisp noobish.
"Hey ass, don't hijack my thread. This is serious." -JoshSCH
![]() |
Other Threads in the C++ Forum
- Previous Thread: noob question, answer probably pretty easy, i just don't know where to start
- Next Thread: Question, basic encrpytion?
Views: 7744 | Replies: 47
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll encryption error file forms fstream function functions game getline givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linux loop looping loops map math matrix memory microsoft newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






