Python Forum
Syntax error for "root = Tk()"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Syntax error for "root = Tk()"
#11
Yeah!!! It runs, after I made some changes to get the GUI window working. I added a few print statements to follow progress. Still fails to connect.

Some of the results:

****
Test button MAC: b'MAC\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

IP is: 192 . 168 . 0 . 168

UDP-IP is: 192.168.0.168

Test button device address: ('192.168.0.168', 50000)

message sent

message sent

message sent

message sent

message sent
*** and then I get the device not found message. Looks like either the socket is not working as expected or the UDP port has changed. I have a query out to a forum for the radio asking what is the default UDP address.

I'm puzzled about the single quotes around the IP address in the "device address". I do not see where they come from or even if they are a problem.

In the mean time, I'd like some input on setting the window, if you are not fed up with me yet. :)

Here is the unaltered code:

# ----------------------------------
#    User Interface
#------------------------------------
def close():
    sock.close()
    root.destroy()
    root.quit()
    
root=Tk()
root.title('Bootloader 2.1')
x = str((root.winfo_screenwidth() - root.winfo_reqwidth()) / 3)
y = str((root.winfo_screenheight() - root.winfo_reqheight()) / 3)
root.geometry('400x300+'+x+'+'+y)
root.maxsize(400, 330)
root.minsize(400, 330)
root.protocol('WM_DELETE_WINDOW', close)
The resulting error:

Error:
Traceback (most recent call last): File "E:\HamStuff\Odyssey\BL2.1\Bootloader2to3Results.pyw", line 24, in <module> root.geometry('400x300+'+x+'+'+y) File "C:\Program Files\Python312\Lib\tkinter\__init__.py", line 2114, in wm_geometry return self.tk.call('wm', 'geometry', self._w, newGeometry) _tkinter.TclError: bad geometry specifier "400x300+573.3333333333334+293.3333333333333"
My guess is that the intent is to place the GUI in a place dependent on the screen size. Also, I suspect the geometry specifier should be an integer, since it is pixels. I modified the code to have fixed values for "x" and "y" or 100 each. That put the GUI in the upper left of the screen.
Reply


Messages In This Thread
Syntax error for "root = Tk()" - by dlwaddel - Jan-25-2024, 02:40 AM
RE: Syntax error for "root = Tk()" - by deanhystad - Jan-25-2024, 05:41 AM
RE: Syntax error for "root = Tk()" - by dlwaddel - Jan-25-2024, 01:25 PM
RE: Syntax error for "root = Tk()" - by deanhystad - Jan-25-2024, 03:43 PM
RE: Syntax error for "root = Tk()" - by dlwaddel - Jan-26-2024, 01:07 PM
RE: Syntax error for "root = Tk()" - by deanhystad - Jan-26-2024, 06:10 PM
RE: Syntax error for "root = Tk()" - by dlwaddel - Jan-27-2024, 02:06 PM
RE: Syntax error for "root = Tk()" - by deanhystad - Jan-27-2024, 03:51 PM
RE: Syntax error for "root = Tk()" - by dlwaddel - Jan-27-2024, 06:42 PM
RE: Syntax error for "root = Tk()" - by deanhystad - Jan-27-2024, 11:37 PM
RE: Syntax error for "root = Tk()" - by dlwaddel - Jan-28-2024, 05:39 PM
RE: Syntax error for "root = Tk()" - by deanhystad - Jan-28-2024, 06:07 PM
RE: Syntax error for "root = Tk()" - by menator01 - Jan-28-2024, 06:47 PM
RE: Syntax error for "root = Tk()" - by dlwaddel - Jan-28-2024, 07:51 PM
RE: Syntax error for "root = Tk()" - by deanhystad - Jan-28-2024, 11:03 PM
RE: Syntax error for "root = Tk()" - by dlwaddel - Jan-29-2024, 12:07 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  POST Syntax error amplay 0 633 Aug-07-2024, 02:43 PM
Last Post: amplay
  is this really a syntax error? Skaperen 4 1,587 May-25-2024, 07:31 AM
Last Post: snippsat
  World Clock syntax error OscarBoots 1 1,078 May-03-2024, 05:20 AM
Last Post: snippsat
Photo SYNTAX ERROR Yannko 3 1,279 Jan-19-2024, 01:20 PM
Last Post: rob101
  Syntax error while executing the Python code in Linux DivAsh 8 4,768 Jul-19-2023, 06:27 PM
Last Post: Lahearle
  Code is returning the incorrect values. syntax error 007sonic 6 2,915 Jun-19-2023, 03:35 AM
Last Post: 007sonic
  syntax error question - string mgallotti 5 2,605 Feb-03-2023, 05:10 PM
Last Post: mgallotti
  Syntax error? I don't see it KenHorse 4 2,680 Jan-15-2023, 07:49 PM
Last Post: Gribouillis
  Syntax error tibbj001 2 1,812 Dec-05-2022, 06:38 PM
Last Post: deanhystad
  Python-for-Android:p4a: syntax error in main.py while compiling apk jttolleson 2 3,939 Sep-17-2022, 04:09 AM
Last Post: jttolleson

Forum Jump:

User Panel Messages

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