[Tutor] Tutor Digest, Vol 130, Issue 47
Tammy Miller
tgmiller5 at hotmail.com
Thu Jan 1 18:31:28 CET 2015
This is regarding the Python drop-down list response.
I would like to create a GUI that has a drop down list containing the data and displayed based on the stats of the list contents.
I am interested in using Tkinter, wxPython or PyGTK. My data is coming from a csv file. I am using Python 2.79 and have Windows 8 as an operating system
Thank you,
> From: tutor-request at python.org
> Subject: Tutor Digest, Vol 130, Issue 47
> To: tutor at python.org
> Date: Wed, 31 Dec 2014 20:00:28 +0100
>
> Send Tutor mailing list submissions to
> tutor at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body 'help' to
> tutor-request at python.org
>
> You can reach the person managing the list at
> tutor-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Tutor digest..."
>
>
> Today's Topics:
>
> 1. Convert string to bytes (shweta kaushik)
> 2. Help on Python drop-down list options (Tammy Miller)
> 3. Re: Help on Python drop-down list options (WolfRage)
> 4. Re: Convert string to bytes (WolfRage)
> 5. Re: Help on Python drop-down list options (Alan Gauld)
> 6. Re: Convert string to bytes (Alan Gauld)
> 7. Re: Convert string to bytes (Alan Gauld)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 31 Dec 2014 15:38:05 +0530
> From: shweta kaushik <coolshwetu at gmail.com>
> To: Tutor at python.org
> Subject: [Tutor] Convert string to bytes
> Message-ID:
> <CAM--9s6oY=YYfkdQNhSr-+sM5DhdvrPgy-zZhDDyBJ2prjO_-g at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> Hi all,
>
> I need help on this problem.
>
> I have one message packet in form of string s = '0xFE, 0x01, 0x01, 0x22,
> 0xFE, 0x02'. I have to send this data to MSP430 microcontroller, but it is
> not taking data if it is string. If I am passing this as hardcoded value s1
> = 0xFE, 0x01, 0x01, 0x22, 0xFE, 0x02 then board is responding. I want to
> convert s as s1 using python.
>
> Please help me out to convert string in normal format for microcontroller
> to respond.
>
> Thanks in advance.
>
> Regards,
> Shweta
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 31 Dec 2014 08:49:17 -0500
> From: Tammy Miller <tgmiller5 at hotmail.com>
> To: "tutor at python.org" <tutor at python.org>
> Subject: [Tutor] Help on Python drop-down list options
> Message-ID: <COL125-W488336EB344D6D2F4D6A6BFA5F0 at phx.gbl>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hello All,
>
>
>
> I need help on the
> following: I have a created a project from a csv file to calculate the
> mean and standard deviation.
>
> However, I would like to
> create a drop-down list and display the mean and standard deviation? Is there a module
> for that?
>
>
>
> Thank you,
>
>
>
> Tammy
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 31 Dec 2014 11:31:14 -0500
> From: WolfRage <wolfrage8765 at gmail.com>
> To: tutor at python.org
> Subject: Re: [Tutor] Help on Python drop-down list options
> Message-ID: <54A424D2.20709 at gmail.com>
> Content-Type: text/plain; charset=windows-1252; format=flowed
>
> What is the user interface that your program is using, currently? IE:
> QT, GTK, Tkinter, Curses, Kivy, Pygame, Or None?
> What is the target system on which your program runs?
> How are you currently viewing the mean and standard deviation results?
> What version of Python are you using and what is your OS?
>
> On 12/31/2014 08:49 AM, Tammy Miller wrote:
> > Hello All,
> >
> >
> >
> > I need help on the
> > following: I have a created a project from a csv file to calculate the
> > mean and standard deviation.
> >
> > However, I would like to
> > create a drop-down list and display the mean and standard deviation? Is there a module
> > for that?
> >
> >
> >
> > Thank you,
> >
> >
> >
> > Tammy
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > Tutor maillist - Tutor at python.org
> > To unsubscribe or change subscription options:
> > https://mail.python.org/mailman/listinfo/tutor
>
>
>
> ------------------------------
>
> Message: 4
> Date: Wed, 31 Dec 2014 11:34:35 -0500
> From: WolfRage <wolfrage8765 at gmail.com>
> To: tutor at python.org
> Subject: Re: [Tutor] Convert string to bytes
> Message-ID: <54A4259B.2000005 at gmail.com>
> Content-Type: text/plain; charset=windows-1252; format=flowed
>
> I wrote a program to help me break out hex strings awhile ago. It was
> written to communicate with a Atmega 168. This is written for Python 3.
> Here is a snippet, see if this helps you.
>
> s4 = "28 40 7A 7C 05 00 00 34"
> hex_array = bytearray.fromhex(s4)
> print(s4)
> print(list(hex_array))
> print(hex_array)
> for byte in list(hex_array):
> print(hex(byte))
> print(bytes([byte]))
>
>
> On 12/31/2014 05:08 AM, shweta kaushik wrote:
> > Hi all,
> >
> > I need help on this problem.
> >
> > I have one message packet in form of string s = '0xFE, 0x01, 0x01, 0x22,
> > 0xFE, 0x02'. I have to send this data to MSP430 microcontroller, but it is
> > not taking data if it is string. If I am passing this as hardcoded value s1
> > = 0xFE, 0x01, 0x01, 0x22, 0xFE, 0x02 then board is responding. I want to
> > convert s as s1 using python.
> >
> > Please help me out to convert string in normal format for microcontroller
> > to respond.
> >
> > Thanks in advance.
> >
> > Regards,
> > Shweta
> > _______________________________________________
> > Tutor maillist - Tutor at python.org
> > To unsubscribe or change subscription options:
> > https://mail.python.org/mailman/listinfo/tutor
>
>
>
> ------------------------------
>
> Message: 5
> Date: Wed, 31 Dec 2014 17:51:25 +0000
> From: Alan Gauld <alan.gauld at btinternet.com>
> To: tutor at python.org
> Subject: Re: [Tutor] Help on Python drop-down list options
> Message-ID: <m81d2r$njo$1 at ger.gmane.org>
> Content-Type: text/plain; charset=windows-1252; format=flowed
>
> On 31/12/14 13:49, Tammy Miller wrote:
>
> > I need help on the
> > following: I have a created a project from a csv file to calculate the
> > mean and standard deviation.
>
> I assume that means you read the data from the CSV file
> and display the stats?
>
> > However, I would like to
> > create a drop-down list and display the mean and standard deviation?
>
> I assume you mean you want to create a GUI that has a "drop down list"
> containing data and you want to display the stats based on the list
> contents?
>
> If so you need to decide what kind of UI you want to use.
> Your choices are:
> 1) CLI using curses (Not on windows)
> 2) Web UI based on HTML/Javascript
> 3) Desktop GUI using Tkinter/WxPython/PyGTK
> (or some other toolkit)
>
> And once you decide your option you need to design what the UI
> looks like - how does the output appear? Is it in a label? a text
> widget? a pop-up dialog?
>
> > Is there a module for that?
>
> Yes, for all of the above.
>
> Option 1 uses the curses module
>
> Option 2 uses standard HTML linked to a CGI(standard library)
> or a web framework(several third-party options)
>
> Option 3: the standard library includes Tkinter,
> the others are third-party downloads.
>
> We can't help much until you make the choices above.
> It will help if you tell us which python version and
> which OS you use.
>
> And once you choose an option which tookkit you want
> to go with (or at least which option and we can advise
> on toolkits based on your experience and your UI visual
> design)
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>
>
>
> ------------------------------
>
> Message: 6
> Date: Wed, 31 Dec 2014 17:57:33 +0000
> From: Alan Gauld <alan.gauld at btinternet.com>
> To: tutor at python.org
> Subject: Re: [Tutor] Convert string to bytes
> Message-ID: <m81deb$t41$1 at ger.gmane.org>
> Content-Type: text/plain; charset=windows-1252; format=flowed
>
> On 31/12/14 10:08, shweta kaushik wrote:
>
> > I have one message packet in form of string s = '0xFE, 0x01, 0x01, 0x22,
> > 0xFE, 0x02'. I have to send this data to MSP430 microcontroller, but it is
> > not taking data if it is string. If I am passing this as hardcoded value s1
> > = 0xFE, 0x01, 0x01, 0x22, 0xFE, 0x02 then board is responding. I want to
> > convert s as s1 using python.
>
> I'm pretty sure you don;t need that, you only need the integer values of
> the hex strings. You can then write those integers directly to your
> controller. Assuming I'm right this should work (Python v2.7):
>
> >>> s = '0xFE, 0x01, 0x01, 0x22, 0xFE, 0x02'
> >>> [int(h,16) for h in s.split(',')]
> [254, 1, 1, 34, 254, 2]
> >>>
>
> HTH
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>
>
>
> ------------------------------
>
> Message: 7
> Date: Wed, 31 Dec 2014 18:53:25 +0000
> From: Alan Gauld <alan.gauld at btinternet.com>
> To: shweta kaushik <coolshwetu at gmail.com>
> Cc: tutor at python.org
> Subject: Re: [Tutor] Convert string to bytes
> Message-ID: <54A44625.3070707 at btinternet.com>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> On 31/12/14 18:03, shweta kaushik wrote:
> > I also did the same thing and its working... but i dint use this. I
> > just did this and it is similar to what you said.
> >
> > >>> s = '0xFE, 0x01, 0x01, 0x22, 0xFE, 0x02'
> > >>> packet = eval(s)
> > (254, 1, 1, 34, 254, 2)
> > >>>
> > this is tuple, which my microcontroller is able to recognize and
> > respond back.
> It works with a fixed string input but using eval() is a big security risk,
> especially if you read the input from a file or network or even a user.
> You could potentially find your hard disk being formatted or similar damage.
>
> An explicit conversion using int() is much safer.
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> https://mail.python.org/mailman/listinfo/tutor
>
>
> ------------------------------
>
> End of Tutor Digest, Vol 130, Issue 47
> **************************************
More information about the Tutor
mailing list