Python Forum
help with showing wifi symbol when connected
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help with showing wifi symbol when connected
#1
Ive got a pi zero w and a ssd1306 128x64 screen and have managed to eventually get something showing up on the screen for examples (yey)

ive got a little project on doing various things which i'll try to learn along the way but ive never done anything in python before at the mo im trying to have the screen show in the top right a wifi symbol when its connected to wifi (and maybe a logo with a diagonal line through the symbol when its disconnected)

can anyone help or point me in the right direction with some simple instructions?

thanks
Reply
#2
Here is everything what you need: https://github.com/rm-hull/luma.oled

Everything is linked on the page, also the Documentation: https://luma-oled.readthedocs.io/en/latest/
You can use PIL for the Images. If you're using Python3 (you should), use instead Pillow.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#3
One way would be to print the unicode for "Antenna with bars" (\u1f4f6), the drawback is: good luck finding a font that will print it. If you do, other users most likely won't have that font. The other way would be to copy the image itself, then try and print it:

print("?")
again, though, no guarantees it will work. For example, both with the same font, using Pycharm the out put is:

Output:
C:\Python36\python.exe C:/Python/scratch.py ? Process finished with exit code 0
 

whilst in the Windows terminal it is two blank boxes.  Not sure how or if the situation be the same on a Linux, Mac or *nix terminal.

The final solution that comes to mind, is to create you own symbol using ASCII art, though that might turn out to be rather large.

My suggestion would be to use a library like "colorama" (which can be installed with 'pip' and is cross platform), map a cursor position, make it green for connected and red for disconnected.

EDIT: Oops, apparently the editor will not allow my to display the icon so it just shows up as a question mark. Sorry. So where you see the "?" just picture in your mind the actual emoji. :-)
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#4
Do you mean this symbol: 🖧?

print('\N{THREE NETWORKED COMPUTERS}')

Hint to post this in a forum:

msg = 'Do you mean this symbol: \N{THREE NETWORKED COMPUTERS}?'.encode('ascii', 'xmlcharrefreplace')
print(msg.decode())
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#5
Thanks all,
i'll have a look at the suggestions and see where i get to.

the 3 networked pc's oould work but would prefer the wifi symbol as im using a pi zero w. i think i definately need to get my head around python beings the Pi's and projects ive seen tend to use it a lot
Reply
#6
Actually, it would be then

msg = 'Do you mean this symbol: \N{ANTENNA WITH BARS}?'.encode('ascii', 'xmlcharrefreplace')
print(msg.decode())
Don't know how you got your little computers where able to show up in the reply  Think
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#7
https://github.com/rm-hull/luma.examples...erminal.py

You need a font which supports the the unicode symbol. They are processed wit PIL. But you can also use a graphic.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#8
I am using unicode symbols to see the battery status in the panel or if the laptop power cable is plugged in
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#9
DeaD_EyE, I was referring more to your actual post. I've tried "pasting" the icon for "ANTENNA WITH BARS", using the emoji method :signal_strength: and using the html code & #128246; (without the space between the "&" and "#"). They all show the icon (except the emoji method) in the preview post, but change to "?" as soon as I "Post" the reply.  I may have to bring this up in the "Board" forum, so's not to hijack this thread.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to check if Skype call is connected or disconnected in Python? boral 1 411 Dec-28-2023, 08:31 AM
Last Post: buran
  Decryption not working if key has same symbol like text Paragoon2 0 323 Nov-11-2023, 09:32 PM
Last Post: Paragoon2
  Convert Excel file into csv with Pipe symbol.. mg24 4 1,348 Oct-18-2022, 02:59 PM
Last Post: Larz60+
  When is stdin not connected to a tty, but can still be used interactively? stevendaprano 1 1,022 Sep-24-2022, 05:06 PM
Last Post: Gribouillis
  arduino and colaboratory with wifi rithikreddypalla 0 1,699 May-22-2021, 06:21 AM
Last Post: rithikreddypalla
  ImportError: /home/pybind11_example.cpython-37m-x86_64-linux-gnu.so: undefined symbol chaitra 2 5,132 Feb-03-2021, 05:14 AM
Last Post: chaitra
  Printing to a printer connected to pi 4 alan 2 2,461 Oct-04-2020, 10:08 PM
Last Post: alan
  Wifi Camera Connection MeenAg 2 3,124 Oct-02-2020, 06:35 PM
Last Post: MeenAg
  Take particular symbol from textbox help samuelbachorik 3 2,180 Apr-14-2020, 03:55 AM
Last Post: steve_shambles
  Hide symbol or characters in regular expression Gateux 0 2,276 Mar-21-2020, 10:25 AM
Last Post: Gateux

Forum Jump:

User Panel Messages

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