* [Caml-list] Why I cannot open a graph with a specific title @ 2004-06-28 19:57 Andy Yang 2004-06-28 20:50 ` Christophe TROESTLER 2004-06-28 21:01 ` Matt Gushee 0 siblings, 2 replies; 5+ messages in thread From: Andy Yang @ 2004-06-28 19:57 UTC (permalink / raw) To: caml-list Hi, all I found that with the following code is OK: open Graphics;; let _ = open_graph "";; However, if I set a title for a widnow open Graphics;; let _ = open_graph "hello";; Ocaml will report "Fatal error: exception Graphics.Graphic_failure("Cannot open display hello"). open_graph has a signature string -> unit. Thanks a lot! Andy __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Why I cannot open a graph with a specific title 2004-06-28 19:57 [Caml-list] Why I cannot open a graph with a specific title Andy Yang @ 2004-06-28 20:50 ` Christophe TROESTLER 2004-06-29 0:37 ` Matt Gushee 2004-06-28 21:01 ` Matt Gushee 1 sibling, 1 reply; 5+ messages in thread From: Christophe TROESTLER @ 2004-06-28 20:50 UTC (permalink / raw) To: yyu08; +Cc: caml-list On Mon, 28 Jun 2004, Andy Yang <yyu08@yahoo.com> wrote: > > let _ = open_graph "hello";; > Ocaml will report "Fatal error: exception > Graphics.Graphic_failure("Cannot open display hello"). Please read the manual: open_graph "foo:0" connects to the display foo:0 and creates a window with the default geometry open_graph "foo:0 300x100+50-0" connects to the display foo:0 and creates a window 300 pixels wide by 100 pixels tall, at location (50,0) open_graph " 300x100+50-0" connects to the default display and creates a window 300 pixels wide by 100 pixels tall, at location (50,0) open_graph "" connects to the default display and creates a window with the default geometry. (this is specific to Unix). Cheers, ChriS ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Why I cannot open a graph with a specific title 2004-06-28 20:50 ` Christophe TROESTLER @ 2004-06-29 0:37 ` Matt Gushee 2004-06-29 8:46 ` Christophe TROESTLER 0 siblings, 1 reply; 5+ messages in thread From: Matt Gushee @ 2004-06-29 0:37 UTC (permalink / raw) To: caml-list On Mon, Jun 28, 2004 at 10:50:22PM +0200, Christophe TROESTLER wrote: > > Please read the manual: > > open_graph "foo:0" connects to the display foo:0 and creates a > window with the default geometry Okay, but can you explain why # open_graph "localhost:0";; fails on my Linux box? If I do $ xhost +localhost before starting the OCaml toplevel, it raises an exception. If not, it causes OCaml to die with Signal 13 (SIGPIPE). I suppose it's redundant to specify "localhost:0," but I don't see a good reason why it shouldn't work. -- Matt Gushee When a nation follows the Way, Englewood, Colorado, USA Horses bear manure through mgushee@havenrock.com its fields; http://www.havenrock.com/ When a nation ignores the Way, Horses bear soldiers through its streets. --Lao Tzu (Peter Merel, trans.) ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Why I cannot open a graph with a specific title 2004-06-29 0:37 ` Matt Gushee @ 2004-06-29 8:46 ` Christophe TROESTLER 0 siblings, 0 replies; 5+ messages in thread From: Christophe TROESTLER @ 2004-06-29 8:46 UTC (permalink / raw) To: mgushee; +Cc: caml-list On Mon, 28 Jun 2004, Matt Gushee <mgushee@havenrock.com> wrote: > > Okay, but can you explain why > > # open_graph "localhost:0";; > > fails on my Linux box? For the same reason that $ xterm -display localhost:0.0 xterm Xt error: Can't open display: localhost:0.0 My guess (not tested) is that this ask for a TCP connection while your Linux distribution starts the server with "-nolisten tcp" (e.g. in /etc/X11/xdm/Xservers). Cheers, ChriS ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Why I cannot open a graph with a specific title 2004-06-28 19:57 [Caml-list] Why I cannot open a graph with a specific title Andy Yang 2004-06-28 20:50 ` Christophe TROESTLER @ 2004-06-28 21:01 ` Matt Gushee 1 sibling, 0 replies; 5+ messages in thread From: Matt Gushee @ 2004-06-28 21:01 UTC (permalink / raw) To: caml-list On Mon, Jun 28, 2004 at 12:57:34PM -0700, Andy Yang wrote: > > I found that with the following code is OK: > > open Graphics;; > let _ = open_graph "";; > > However, if I set a title for a widnow > > open Graphics;; > let _ = open_graph "hello";; > > Ocaml will report "Fatal error: exception > Graphics.Graphic_failure("Cannot open display hello"). > > open_graph has a signature string -> unit. Yes, and did you read what the manual says about that string? The string is not supposed to be the window title. On X11, it's the the name of an X display and/or a geometry specification. I'm not sure what it's supposed to be on Win32 platforms. Nonetheless, the behavior of open_graph leaves something to be desired. For example, # open_graph " 400x600" (* Note the leading space. *);; - : unit = () # open_graph "400x600";; Exception: Graphics.Graphic_failure "Cannot open display 400x600". So the function distinguishes a display name from a geometry spec by whether there is a leading space? Yech. Maybe the signature should be open_graph : ?display:string -> ?geometry:string -> unit -> unit And at least one of the following should work: # open_graph "0";; Exception: Graphics.Graphic_failure "Cannot open display 0". # open_graph "0.0";; Exception: Graphics.Graphic_failure "Cannot open display 0.0". # open_graph "localhost:0.0";; Exception: Graphics.Graphic_failure "Cannot open display localhost:0.0". # open_graph "127.0.0.1:0.0";; Exception: Graphics.Graphic_failure "Cannot open display 127.0.0.1:0.0". # open_graph "localhost:0";; Signal 13 bash-2.05a$ Brilliant. P.S. When asking questions of this sort, it would be helpful if you gave some information about your system, e.g. the platform and version of OCaml--especially with libraries like Graphics that have platform-dependent features. -- Matt Gushee When a nation follows the Way, Englewood, Colorado, USA Horses bear manure through mgushee@havenrock.com its fields; http://www.havenrock.com/ When a nation ignores the Way, Horses bear soldiers through its streets. --Lao Tzu (Peter Merel, trans.) ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-06-29 12:04 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-06-28 19:57 [Caml-list] Why I cannot open a graph with a specific title Andy Yang 2004-06-28 20:50 ` Christophe TROESTLER 2004-06-29 0:37 ` Matt Gushee 2004-06-29 8:46 ` Christophe TROESTLER 2004-06-28 21:01 ` Matt Gushee
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).